docs / CONTEXT_COMPRESSOR_INTEGRATION.md
docs / CONTEXT_COMPRESSOR_INTEGRATION.md
context-compressor 0.7.0+ owns prediction flow, exact prompt/token budgeting, main-chat tool sessions, mid-task compaction, cached summaries, and attachment memory Agentic Workspace 0.3.0+ owns tools, workspace policy, the permission gate and approvals, plans, transactions, artifacts, jobs, To-Do boards, research projects, notes and workspace memory, browser sessions, and durable sub-agent state
Agentic Workspace registers a tools provider and a prompt preprocessor only. It does not install a prediction-loop handler, so the two plugins do not nest competing generation loops. The preprocessor handles /accept and /deny and appends the <agentic-mode> hint outside Auto mode; /compress, /compact and /usage pass through untouched so the compressor keeps owning them.
The compressor contains a dedicated agenticProtocol.ts parser for agentic-workspace/v1 results. Before generic head/tail truncation, it:
retention.omit_when_summarizing;summary, retention.facts, error state, and artifact references;The summarizer and consolidation prompts also contain explicit sections for durable workflow state, verification evidence, research findings, and source ledgers.
changes lists transactions, runs, command jobs (id, status, executable, exitCode, startedAt), task boards, research projects, pending or approved approvals, and plans with their planPath; capabilities reports the permission mode, the active or pending plan, and the pending-approval count. Both are safe to call at any time and are never gated. The jobs array is how a model reattaches to a background job it started before compaction — it is not declared in omit_when_summarizing, and jobs is already recognised by the compressor's job-prefix rule.
Staged results (data.status = "pending_approval"), plan proposals and changes carry plan_* and approval_* ids in summary and retention.facts — for example approval approval_… pending: Commit tx_…, plan plan_… pending approval: <title>, permission mode Manual (0) — and the staged summary spells out the exact resume call. Those fields are preserved by the compressor's agentic path, so the model can still act on the user's /accept after compaction; the <agentic-mode> hint on the next user message restates the pending plan or approvals regardless.
Against published context-compressor 0.7.0 (Hub revision 22), what agenticProtocol.ts keeps from data is decided per key by isImportantKey: a fixed set of names (including id, status, mode, title, kind, destructive, plan, files, commands), any key ending in id/Id, path/Path, status, count, url or sha256, and any key starting with transaction|run|job|task|todo|board|research|source|query|checkpoint. Its normal compaction, applied to every envelope, copies only recognised keys and recurses only through them. So from a staged result data.status, data.mode and the tool's own recognised fields survive, while the whole object — , , , and — is dropped, because matches none of the three rules. From a plan result , , , and (its , , , ) survive; , , , and do not. From and , , , , and are dropped. Only when the compacted envelope is still over budget (12,000 characters by default) does the recovery-field walker descend into every key, and then , , , and the id-suffixed fields are recorded — not or . The and arrays in are deliberately declared in : they are the recovery index for the permission gate, they are small ( defaults to 20 entries of id, status, title and ), and a model that lost context has to be able to act on a pending approval without re-issuing the call. A compressor that recognises those keys therefore keeps them; one that does not drops them as unrecognised keys, and their first five ids and statuses stay in either way. The four bulky listings in the same result — , , , — are still omitted. Finally, the summarizer prompt names and ids to preserve verbatim but not /.
The compressor side of this is implemented and ships in the context-compressor release that accompanies Agentic Workspace 0.3.0: agenticProtocol.ts there recognises approval, approvals, plans, activePlan, pendingPlan and pendingApprovals, keeps resume.tool and every entry of resume.arguments verbatim, re-attaches the staged approval on the over-budget path, and the summarizer prompts name the plan_/approval_ prefixes (that rendering change bumps its cached-summary namespace, so summaries regenerate once on upgrade). Published context-compressor 0.7.0 (Hub revision 22) predates it: against that revision summary (kept up to 4,000 characters) and retention.facts (up to 60, 30 when over budget) are the contract for these ids, and the staged summary already spells out the exact resume call. workspace_inspect(action="changes") and workspace_plan(action="current") recover the state either way.
Main-chat compaction cannot safely reach inside an unbounded nested model transcript. Agentic Workspace therefore persists state and reconstructs each internal pass. The compressor protects the main conversation; pass projection protects the nested agent.
context-compressor 0.7.0+ owns prediction flow, exact prompt/token budgeting, main-chat tool sessions, mid-task compaction, cached summaries, and attachment memory Agentic Workspace 0.3.0+ owns tools, workspace policy, the permission gate and approvals, plans, transactions, artifacts, jobs, To-Do boards, research projects, notes and workspace memory, browser sessions, and durable sub-agent state
Agentic Workspace registers a tools provider and a prompt preprocessor only. It does not install a prediction-loop handler, so the two plugins do not nest competing generation loops. The preprocessor handles /accept and /deny and appends the <agentic-mode> hint outside Auto mode; /compress, /compact and /usage pass through untouched so the compressor keeps owning them.
The compressor contains a dedicated agenticProtocol.ts parser for agentic-workspace/v1 results. Before generic head/tail truncation, it:
retention.omit_when_summarizing;summary, retention.facts, error state, and artifact references;The summarizer and consolidation prompts also contain explicit sections for durable workflow state, verification evidence, research findings, and source ledgers.
changes lists transactions, runs, command jobs (id, status, executable, exitCode, startedAt), task boards, research projects, pending or approved approvals, and plans with their planPath; capabilities reports the permission mode, the active or pending plan, and the pending-approval count. Both are safe to call at any time and are never gated. The jobs array is how a model reattaches to a background job it started before compaction — it is not declared in omit_when_summarizing, and jobs is already recognised by the compressor's job-prefix rule.
Staged results (data.status = "pending_approval"), plan proposals and changes carry plan_* and approval_* ids in summary and retention.facts — for example approval approval_… pending: Commit tx_…, plan plan_… pending approval: <title>, permission mode Manual (0) — and the staged summary spells out the exact resume call. Those fields are preserved by the compressor's agentic path, so the model can still act on the user's /accept after compaction; the <agentic-mode> hint on the next user message restates the pending plan or approvals regardless.
Against published context-compressor 0.7.0 (Hub revision 22), what agenticProtocol.ts keeps from data is decided per key by isImportantKey: a fixed set of names (including id, status, mode, title, kind, destructive, plan, files, commands), any key ending in id/Id, path/Path, status, count, url or sha256, and any key starting with transaction|run|job|task|todo|board|research|source|query|checkpoint. Its normal compaction, applied to every envelope, copies only recognised keys and recurses only through them. So from a staged result data.status, data.mode and the tool's own recognised fields survive, while the whole object — , , , and — is dropped, because matches none of the three rules. From a plan result , , , and (its , , , ) survive; , , , and do not. From and , , , , and are dropped. Only when the compacted envelope is still over budget (12,000 characters by default) does the recovery-field walker descend into every key, and then , , , and the id-suffixed fields are recorded — not or . The and arrays in are deliberately declared in : they are the recovery index for the permission gate, they are small ( defaults to 20 entries of id, status, title and ), and a model that lost context has to be able to act on a pending approval without re-issuing the call. A compressor that recognises those keys therefore keeps them; one that does not drops them as unrecognised keys, and their first five ids and statuses stay in either way. The four bulky listings in the same result — , , , — are still omitted. Finally, the summarizer prompt names and ids to preserve verbatim but not /.
The compressor side of this is implemented and ships in the context-compressor release that accompanies Agentic Workspace 0.3.0: agenticProtocol.ts there recognises approval, approvals, plans, activePlan, pendingPlan and pendingApprovals, keeps resume.tool and every entry of resume.arguments verbatim, re-attaches the staged approval on the over-budget path, and the summarizer prompts name the plan_/approval_ prefixes (that rendering change bumps its cached-summary namespace, so summaries regenerate once on upgrade). Published context-compressor 0.7.0 (Hub revision 22) predates it: against that revision summary (kept up to 4,000 characters) and retention.facts (up to 60, 30 when over budget) are the contract for these ids, and the staged summary already spells out the exact resume call. workspace_inspect(action="changes") and workspace_plan(action="current") recover the state either way.
Main-chat compaction cannot safely reach inside an unbounded nested model transcript. Agentic Workspace therefore persists state and reconstructs each internal pass. The compressor protects the main conversation; pass projection protects the nested agent.
data.approvalidkindtitledestructiveresumeapprovalplanIdplanPathstatustitleplantitleobjectivefilescommandsrevisionsupersedesstepsrisksquestionscapabilitiesoverviewactivePlanpendingPlanpendingApprovalspermissionModenotesdata.approval.id.kind.title.destructiveresume.argumentsresume.toolarguments.actionapprovalsplanschangesomit_when_summarizinglimitplanPathretention.factstransactionsrunstaskBoardsresearchProjectstodo_/item_/checkpoint_research_/query_/source_plan_approval_todo_*, start a coding run_*, apply a tx_*, and run a job_*.research_* project and fetch at least one source_*.plan_*, reply /accept, and perform one gated action; in Manual mode, stage an approval_* and leave it pending.MEMORY.md with workspace_notes./compress while IDs and artifacts are in older messages.plan_*/approval_*), statuses, paths, URLs, hashes, and test evidence./accept to the pending approval and confirm the model issues exactly the resume call; recover every other object using the calls above.Transactions: .agentic/transactions/<tx-id>/
Jobs: .agentic/jobs/<job-id>/
Agent runs: .agentic/runs/<run-id>/
To-Do boards: .agentic/tasks/<todo-id>/state.json
Research: .agentic/research/<research-id>/
Approvals: .agentic/approvals/state.json
Plans: .agentic/plans/<plan_id>/plan.md
Notes: .agentic/notes/<name>.md
Memory: .agentic/MEMORY.md
Artifacts: .agentic/artifacts/
workspace_inspect { action: "changes" }
workspace_inspect { action: "capabilities" }
workspace_plan { action: "current" }
workspace_plan { action: "show", plan_id: "plan_..." }
workspace_notes { action: "read", memory: true }
workspace_notes { action: "list" }
workspace_edit { action: "show", transaction_id: "tx_..." }
workspace_command { action: "status", job_id: "job_..." }
workspace_tasks { action: "show", board_id: "todo_..." }
workspace_tasks { action: "next", board_id: "todo_..." }
workspace_research { action: "show", research_id: "research_..." }
workspace_agent { action: "status", run_id: "run_..." }
workspace_agent { action: "history", run_id: "run_...", limit: 50 }
data.approvalidkindtitledestructiveresumeapprovalplanIdplanPathstatustitleplantitleobjectivefilescommandsrevisionsupersedesstepsrisksquestionscapabilitiesoverviewactivePlanpendingPlanpendingApprovalspermissionModenotesdata.approval.id.kind.title.destructiveresume.argumentsresume.toolarguments.actionapprovalsplanschangesomit_when_summarizinglimitplanPathretention.factstransactionsrunstaskBoardsresearchProjectstodo_/item_/checkpoint_research_/query_/source_plan_approval_todo_*, start a coding run_*, apply a tx_*, and run a job_*.research_* project and fetch at least one source_*.plan_*, reply /accept, and perform one gated action; in Manual mode, stage an approval_* and leave it pending.MEMORY.md with workspace_notes./compress while IDs and artifacts are in older messages.plan_*/approval_*), statuses, paths, URLs, hashes, and test evidence./accept to the pending approval and confirm the model issues exactly the resume call; recover every other object using the calls above.Transactions: .agentic/transactions/<tx-id>/
Jobs: .agentic/jobs/<job-id>/
Agent runs: .agentic/runs/<run-id>/
To-Do boards: .agentic/tasks/<todo-id>/state.json
Research: .agentic/research/<research-id>/
Approvals: .agentic/approvals/state.json
Plans: .agentic/plans/<plan_id>/plan.md
Notes: .agentic/notes/<name>.md
Memory: .agentic/MEMORY.md
Artifacts: .agentic/artifacts/
workspace_inspect { action: "changes" }
workspace_inspect { action: "capabilities" }
workspace_plan { action: "current" }
workspace_plan { action: "show", plan_id: "plan_..." }
workspace_notes { action: "read", memory: true }
workspace_notes { action: "list" }
workspace_edit { action: "show", transaction_id: "tx_..." }
workspace_command { action: "status", job_id: "job_..." }
workspace_tasks { action: "show", board_id: "todo_..." }
workspace_tasks { action: "next", board_id: "todo_..." }
workspace_research { action: "show", research_id: "research_..." }
workspace_agent { action: "status", run_id: "run_..." }
workspace_agent { action: "history", run_id: "run_...", limit: 50 }