AICTX

Continuity Guard

Continuity Guard is a lightweight read-only check for important action boundaries. It helps compatible agents re-ground against repo-local AICTX state before edits, risky commands, finalization, final answers, scope changes, agent switches, or continuing after idle/restart.

It does not detect context compaction directly, log reasoning, call external services, mutate continuity state, or return the full resume capsule.

CLI

aictx guard --repo . --action edit --paths src/example.py --intent "fix parser edge case" --risk normal --json

Supported actions:

before_first_edit edit risky_command finalize final_answer scope_change agent_switch continue_after_idle

Options:

--paths <path>      repeatable path involved in the action
--command <command> command involved in the action
--intent <text>     short action intent
--risk low|normal|high
--agent-id <id>
--session-id <id>
--json

MCP

Readonly MCP profile exposes:

aictx_continuity_guard

Example input:

{
  "action": "edit",
  "paths": ["src/example.py"],
  "command": "",
  "intent": "fix parser edge case",
  "risk": "normal",
  "agent_id": "codex",
  "session_id": "optional-session-id"
}

Output

The guard returns compact JSON:

{
  "status": "ok",
  "decision": "allow",
  "warnings": [],
  "checks": {
    "work_state": "ok",
    "contract_alignment": "ok",
    "continuity_quality": "ok",
    "lifecycle": "ok",
    "validation": "ok"
  },
  "suggested_next": "continue"
}

Decision values:

Call the guard before important boundaries, not every trivial step:

Agent lifecycle contract

aictx resume --json includes compact metadata that tells supported agents when to use guard checks:

Routine agent startup can use aictx resume --repo . --task "<task goal>" --json --brief for a smaller payload. Standard mode remains the default for compatibility.

aictx finalize captures a compact git-state snapshot when Git is available and persists handoffs with agent_id, adapter_id, session_id, and evidence_quality.