Skip to content

docs(policies): replace three session policies with one falsifiable spec - #308

Merged
piyushmakhija28 merged 1 commit into
mainfrom
feat/session-management-policy-v3
Aug 10, 2026
Merged

piyushmakhija28 merged 1 commit into
mainfrom
feat/session-management-policy-v3

Conversation

@piyushmakhija28

Copy link
Copy Markdown
Collaborator

What

Replaces session-chaining-policy.md, session-memory-policy.md and session-pruning-policy.md (1,876 lines) with a single docs/policies/session-management-policy.md (204 lines).

Why

The three superseded policies described a system that was never built. Between them they named fourteen scripts — session-loader.py, auto-save-session.py, session-auto-save-daemon.py, archive-old-sessions.py, session-chain-manager.py, clear-session-handler.py and others. None existed on disk. The real implementation was a different shape entirely: an MCP server and a LangGraph node.

Because the spec and the code never described the same system, drift between them was undetectable by construction. Every defect found in the 2026-08 session-management audit was downstream of that.

The replacement is falsifiable by design

  • §7 Component map names real module paths and marks each one's status (Working / Partial / Planned / Being retired), so a reader can check the claim rather than trust it.
  • Invariant I6 makes keeping §7 honest a rule: a component named there must exist at the stated path, or be explicitly marked planned with the phase that delivers it. Naming a component that does not exist is the specific failure that made the superseded policies worthless.

Git decoupling

session-memory-policy.md carried an entire Git Auto-Commit Integration section that ran git add -A / commit / push from the session layer, plus repos_committed and commit_hashes schema fields.

§3 now makes that a hard architectural boundary — the session layer may never import or call git, GitHub, PR or Jira. One direction remains permitted: the SDLC layer MAY write opaque, inbound, one-way metadata (issue_id, agent_id, failure reasons) into the session store, which keeps "which agent failed in which session?" answerable without the coupling.

Also recorded

Two findings from the audit that constrain any future work in this area:

  • Two live session MCP implementations existed — the in-engine copy and the standalone repo diverged by over 1,300 lines while both remained live, with Claude's tool calls reaching one and the engine's in-process imports reaching the other.
  • scripts/tools/create_mcp_repos.py is destructive — it overwrites server.py and replaces base/ in existing repos. All 13 target repos have evolved past their generated state (75 commits, ~29 merged PRs). It must not be run until it is made non-destructive.

Scope

Documentation only. No code changes, no behaviour changes. This is Phase 0 of the session-management remediation; the implementation phases follow separately.

🤖 Generated with Claude Code

The three superseded policies described a system that was never built.
Between them they named fourteen scripts -- session-loader.py,
auto-save-session.py, session-auto-save-daemon.py, archive-old-sessions.py,
session-chain-manager.py, clear-session-handler.py and others -- none of
which existed on disk. The real implementation was a different shape
entirely: an MCP server and a LangGraph node.

Because the spec and the code never described the same system, drift
between them was undetectable by construction. Every defect found in the
2026-08 audit was downstream of that.

The replacement is written to be falsifiable. Section 7 names real module
paths and marks each one's status, so a reader can check the claim rather
than trust it, and invariant I6 makes keeping that section honest a rule
rather than a courtesy: a component named there must exist at the stated
path, or be explicitly marked planned with the phase that delivers it.

Also removes the git coupling. session-memory-policy.md carried an entire
Git Auto-Commit Integration section that ran git add -A / commit / push
from the session layer, and a session schema with repos_committed and
commit_hashes fields. Section 3 now makes that a hard architectural
boundary, while permitting one-way inbound metadata (issue_id, agent_id,
failure reasons) so that "which agent failed in which session" stays
answerable without the coupling.

1,876 lines -> 232.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@piyushmakhija28
piyushmakhija28 merged commit dce75e3 into main Aug 10, 2026
2 checks passed
@piyushmakhija28
piyushmakhija28 deleted the feat/session-management-policy-v3 branch August 10, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant