Skip to content

Commit 463b0ef

Browse files
Yanjunclaude
andcommitted
feat: sidecar boot ritual enforcement — nag until hunger is called
Every MCP tool response now checks if boot_brief is stale (>2h). If stale, sidecar includes WARNING telling Agent to run hunger immediately. Once myco_hunger(execute=true) runs, it refreshes boot_brief and the warning disappears from all subsequent tool responses. This is the strongest enforcement possible within MCP constraints: passive-aggressive nagging on every tool call until the Agent complies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8d42837 commit 463b0ef

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

src/myco/mcp_server.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,27 @@ def _compute_sidecar(root: Path) -> dict:
9595
if "•" in line and "healthy" not in line:
9696
top_signal = line.split("•")[-1].strip()[:60]
9797
break
98-
return {
98+
# Check if boot ritual was executed this session.
99+
# If boot_brief is older than 2 hours, Agent likely hasn't run
100+
# myco_hunger(execute=true) this session → nag.
101+
import time as _time
102+
boot_stale = True
103+
if brief.exists():
104+
age_seconds = _time.time() - brief.stat().st_mtime
105+
boot_stale = age_seconds > 7200 # 2 hours
106+
107+
result = {
99108
"raw_count": raw,
100109
"signals_count": signals_count,
101110
"top_signal": top_signal,
102111
}
112+
if boot_stale:
113+
result["WARNING"] = (
114+
"Boot ritual not executed this session! "
115+
"Call myco_hunger(execute=true) IMMEDIATELY — "
116+
"this is the FIRST action every session per MYCO.md."
117+
)
118+
return result
103119
except Exception:
104120
return {"raw_count": -1, "signals_count": -1, "top_signal": "error"}
105121

@@ -1264,6 +1280,13 @@ async def myco_hunger(
12641280
result["pipeline_hint"] = "Build — signals advisory only, proceed with caution"
12651281
result["pipeline_ref"] = "skills/sprint-pipeline.md"
12661282

1283+
# Refresh boot brief so sidecar knows hunger was run this session
1284+
try:
1285+
from myco.notes import write_boot_brief
1286+
write_boot_brief(root, report)
1287+
except Exception:
1288+
pass # best-effort
1289+
12671290
return json.dumps(result, ensure_ascii=False, indent=2)
12681291

12691292

0 commit comments

Comments
 (0)