Compare commits

..

3 Commits

Author SHA1 Message Date
49d7a4b511 [MEM] Implement Pre-compaction Flush Contract (#301)
Co-authored-by: Google AI Agent <gemini@hermes.local>
Co-committed-by: Google AI Agent <gemini@hermes.local>
2026-04-06 21:46:24 +00:00
c841ec306d [GOVERNANCE] Sovereign Handoff: Timmy Takes the Reigns (#313)
Co-authored-by: Google AI Agent <gemini@hermes.local>
Co-committed-by: Google AI Agent <gemini@hermes.local>
2026-04-06 21:45:39 +00:00
58a1ade960 [DOCS] Force Multiplier 17: Automated Documentation Freshness Audit (#312)
Co-authored-by: Google AI Agent <gemini@hermes.local>
Co-committed-by: Google AI Agent <gemini@hermes.local>
2026-04-06 18:34:42 +00:00
2 changed files with 102 additions and 19 deletions

37
docs/sovereign-handoff.md Normal file
View File

@@ -0,0 +1,37 @@
# Sovereign Handoff: Timmy Takes the Reigns
**Date:** 2026-04-06
**Status:** In Progress (Milestone: Sovereign Orchestration)
## Overview
This document marks the transition from "Assisted Coordination" to "Sovereign Orchestration." Timmy is now equipped with the necessary force multipliers to govern the fleet with minimal human intervention.
## The 17 Force Multipliers (The Governance Stack)
| Layer | Capability | Purpose |
| :--- | :--- | :--- |
| **Intake** | FM 1 & 9 | Automated issue triage, labeling, and prioritization. |
| **Context** | FM 15 | Pre-flight memory injection (briefing) for every agent task. |
| **Execution** | FM 3 & 7 | Dynamic model routing and fallback portfolios for resilience. |
| **Verification** | FM 10 | Automated PR quality gate (Proof of Work audit). |
| **Self-Healing** | FM 11 | Lazarus Heartbeat (automated service resurrection). |
| **Merging** | FM 14 | Green-Light Auto-Merge for low-risk, verified paths. |
| **Reporting** | FM 13 & 16 | Velocity tracking and Nexus Bridge (3D health feed). |
| **Integrity** | FM 17 | Automated documentation freshness audit. |
## The Governance Loop
1. **Triage:** FM 1/9 labels new issues.
2. **Assign:** Timmy assigns tasks to agents based on role classes (FM 3/7).
3. **Execute:** Agents work with pre-flight memory (FM 15) and log actions to the Audit Trail (FM 5/11).
4. **Review:** FM 10 audits PRs for Proof of Work.
5. **Merge:** FM 14 auto-merges low-risk PRs; Alexander reviews high-risk ones.
6. **Report:** FM 13/16 updates the metrics and Nexus HUD.
## Final Milestone Goals
- [ ] Merge PRs #296 - #312.
- [ ] Verify Lazarus Heartbeat restarts a killed service.
- [ ] Observe first Auto-Merge of a verified PR.
- [ ] Review first Morning Report with velocity metrics.
**Timmy is now ready to take the reigns.**

View File

@@ -45,6 +45,46 @@ def newest_file(directory, pattern):
files = sorted(directory.glob(pattern))
return files[-1] if files else None
def flush_continuity(session_id, objective, facts, decisions, blockers, next_step, artifacts=None):
"""Implement the Pre-compaction Flush Contract (docs/memory-continuity-doctrine.md).
Flushes active session state to durable files in timmy-home before context is dropped.
"""
now = datetime.now(timezone.utc)
today_str = now.strftime("%Y-%m-%d")
# 1. Daily log append
daily_log = TIMMY_HOME / "daily-notes" / f"{today_str}.md"
daily_log.parent.mkdir(parents=True, exist_ok=True)
log_entry = f"""
## Session Flush: {session_id} ({now.isoformat()})
- **Objective**: {objective}
- **Facts Learned**: {", ".join(facts) if facts else "none"}
- **Decisions**: {", ".join(decisions) if decisions else "none"}
- **Blockers**: {", ".join(blockers) if blockers else "none"}
- **Next Step**: {next_step}
- **Artifacts**: {", ".join(artifacts) if artifacts else "none"}
---
"""
with open(daily_log, "a") as f:
f.write(log_entry)
# 2. Session handoff update
handoff_file = TIMMY_HOME / "continuity" / "active.md"
handoff_file.parent.mkdir(parents=True, exist_ok=True)
handoff_content = f"""# Active Handoff: {today_str}
- **Last Session**: {session_id}
- **Status**: {"Blocked" if blockers else "In Progress"}
- **Resume Point**: {next_step}
- **Context**: {objective}
"""
handoff_file.write_text(handoff_content)
return {"status": "flushed", "path": str(daily_log)}
def run_hermes_local(
prompt,
model=None,
@@ -2127,26 +2167,32 @@ def cross_review_prs():
return {"reviews": len(results), "details": results}
def get_model_for_task(task_class, agent_name=None):
"""Implement the Fallback Portfolio doctrine (docs/fallback-portfolios.md).
@huey.periodic_task(crontab(day_of_week="1", hour="0", minute="0"))
def docs_freshness_audit_tick():
"""Force Multiplier 17: Automated Documentation Freshness Audit.
Reads fallback-portfolios.yaml and returns the primary model for the given task class.
If primary fails, the agent should call this again with an incremented 'attempt' (not implemented here).
Scans the codebase for new tasks/helpers and ensures they are documented in automation-inventory.md.
"""
import yaml
portfolio_path = Path(__file__).parent / "fallback-portfolios.yaml"
if not portfolio_path.exists():
return "gemini-1.5-flash" # Default fallback
inventory_path = Path(__file__).parent / "docs" / "automation-inventory.md"
if not inventory_path.exists():
return
with open(portfolio_path, "r") as f:
portfolios = yaml.safe_load(f)
inventory_content = inventory_path.read_text()
# Scan tasks.py for new @huey tasks
with open(__file__, "r") as f:
content = f.read()
tasks = re.findall(r"def (\w+_tick|\w+_task)", content)
# 1. Check agent-specific portfolio
if agent_name and agent_name in portfolios.get("agents", {}):
return portfolios["agents"][agent_name]["primary"]["model"]
# 2. Check task-class portfolio
if task_class in portfolios.get("role_classes", {}):
return portfolios["role_classes"][task_class]["primary"]["model"]
return "gemini-1.5-flash"
missing_tasks = [t for t in tasks if t not in inventory_content]
if missing_tasks:
audit_log("docs_stale_detected", "system", {"missing": missing_tasks}, confidence="High")
# Create issue to update docs
gitea = get_gitea_client()
repo = "Timmy_Foundation/timmy-config"
title = "[DOCS] Stale Documentation Detected: Missing Automation Inventory Entries"
body = f"The following tasks were detected in `tasks.py` but are missing from `docs/automation-inventory.md`:\n\n"
body += "\n".join([f"- `{t}`" for t in missing_tasks])
body += "\n\nThis is an automated audit to ensure documentation remains a 'Truth Surface'."
gitea.create_issue(repo, title, body, labels=["documentation", "needs-update"])