forked from openclaw/openclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
GUT post-compaction AGENTS.md injection #258
Copy link
Copy link
Closed
Description
Summary
Remove readPostCompactionContext() and its injection in agent-runner.ts. This is Pi-era layer blurring — the middleware reads AGENTS.md from the workspace directory and injects it into agent context after conversation compaction. CLI agents manage their own context; middleware should not read workspace files to inject into agent sessions.
This item is independent of the template/workspace cleanup chain — it can be done in parallel.
What to Delete
src/auto-reply/reply/post-compaction-context.ts(~118 lines) — containsreadPostCompactionContext()which reads AGENTS.md from workspace and builds a system eventsrc/auto-reply/reply/post-compaction-context.test.ts
What to Modify
src/auto-reply/reply/agent-runner.ts— removereadPostCompactionContextimport and its injection at approximately L669-684 (the block that reads workspace AGENTS.md and prepends it as a system event after compaction)
What to Evaluate
src/auto-reply/reply/post-compaction-audit.ts— check if it has callers beyond the post-compaction injection. If it only serves the deleted pipeline, delete it too. If it has independent uses (e.g., general audit functionality), keep it.
Acceptance Criteria
-
post-compaction-context.tsand its test file are deleted -
agent-runner.tsno longer imports or callsreadPostCompactionContext -
post-compaction-audit.tsevaluated — deleted if no other callers, kept if independently used -
grep -ri "readPostCompactionContext\|post-compaction-context" src/returns zero hits (excluding the audit file if kept) - Build passes, existing tests pass
Context
readPostCompactionContext()readsAGENTS.mdfrom the workspace using the same workspace resolution as other Pi-era code. It builds a "system" event containing the file's content and injects it into the conversation after compaction.- This was designed for the Pi-embedded execution model where the middleware controlled the agent's context window. In the AgentRuntime/ChannelBridge architecture, CLI agents manage their own compaction and context.
- The injection point in
agent-runner.tsis in the compaction/context-building section — look for imports frompost-compaction-context.js.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels