Skip to content

feat(opencode): context edit v2 — classifier, lifecycle markers, thread distillation#5

Merged
e6qu merged 1 commit intodevfrom
feat/context-edit-v2
Mar 15, 2026
Merged

feat(opencode): context edit v2 — classifier, lifecycle markers, thread distillation#5
e6qu merged 1 commit intodevfrom
feat/context-edit-v2

Conversation

@e6qu
Copy link
Copy Markdown
Owner

@e6qu e6qu commented Mar 15, 2026

Issue for this PR

N/A

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Context editing improvements, new agents, lifecycle markers, thread distillation, documentation.

Context editing:

  • query and toolName targeting for context_edit — no raw IDs needed
  • Lifecycle markers: discardable, ephemeral, side-thread, pinned with configurable turn-based auto-cleanup
  • Deterministic sweeper processes lifecycle markers without LLM calls
  • Privileged agents (focus, compaction) can edit any message including user input
  • /reset-context command restores all edits from CAS

New tools:

  • classifier_threads: classifies messages by topic (main/side/mixed) using the classifier agent
  • distill_threads: classifies messages, parks side threads, stores per-session thread metadata

New agents:

  • classifier: read-only, labels messages by topic (enabled by default, inherits session model)
  • focus: label-driven context cleanup (disabled by default, invoked via /focus)
  • focus-rewrite-history: full conversation rewrite with user confirmation (disabled by default)
  • All agents configurable via opencode.jsonc — model override, enable/disable

Commands:

  • /btw: side conversation via subagent
  • /focus: classify + cleanup
  • /focus-rewrite-history: full conversation rewrite
  • /reset-context: undo all context edits

Config-based control:

  • No feature toggles — tools disabled via "tool_name": false in tools config
  • Agents disabled via "agent_name": { "disable": true } in agent config
  • Model overrides per-agent

Documentation:

  • docs/context-editing.md: tools, operations, lifecycle markers, safety constraints
  • docs/schema.md: new tables (CAS, edit graph, side threads), modified part fields
  • docs/agents.md: classifier, focus, models, configuration
  • Cleaned up research docs, cross-linked from README
  • AGENTS.md: no-bypass-hooks rule, context editing guidance

How did you verify your code works?

  • All 1313 unit tests pass
  • Pre-commit hooks pass (format, typecheck, tests)
  • Manual 16-turn CLI test verified all operations end-to-end

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@e6qu e6qu force-pushed the feat/context-edit-v2 branch from 12349a0 to 36be45b Compare March 15, 2026 15:30
@e6qu e6qu changed the title feat(opencode): context edit v2 — query targeting, on-demand focus, /btw and /focus commands feat(opencode): context edit v2 — classifier + label-driven focus, query targeting, /btw and /focus Mar 15, 2026
@e6qu e6qu force-pushed the feat/context-edit-v2 branch from 36be45b to c746a02 Compare March 15, 2026 15:34
@e6qu e6qu force-pushed the feat/context-edit-v2 branch from 89cb54f to 46a34e5 Compare March 15, 2026 21:04
@e6qu e6qu changed the title feat(opencode): context edit v2 — classifier + label-driven focus, query targeting, /btw and /focus feat(opencode): context edit v2 — classifier, lifecycle markers, thread distillation Mar 15, 2026
…ad distillation

Context editing improvements:
- query and toolName targeting for context_edit (no raw IDs needed)
- Lifecycle markers on parts: discardable, ephemeral, side-thread, pinned
- Deterministic sweeper auto-hides/externalizes expired markers
- Privileged agents (focus, compaction) can edit any message
- /reset-context command restores all edits from CAS

New tools:
- classifier_threads: classify messages by topic (main/side/mixed)
- distill_threads: classify + park side threads + store metadata

Agents:
- classifier: read-only, labels messages by topic (enabled by default)
- focus: label-driven cleanup (disabled by default, /focus command)
- focus-rewrite-history: full rewrite with user confirmation (disabled)
- All agents configurable via opencode.jsonc (model, disable)

Commands:
- /btw: side conversation via subagent
- /focus: classify + cleanup
- /focus-rewrite-history: full conversation rewrite
- /reset-context: undo all context edits from CAS

Config-based control (no feature toggles):
- Tools: set to false in tools config to disable
- Agents: set disable: true, override model per-agent

Documentation:
- docs/context-editing.md: tools, operations, lifecycle markers
- docs/schema.md: new tables, modified part fields
- docs/agents.md: classifier, focus, models, configuration
- Cleaned up research docs, cross-linked from README
- AGENTS.md: no-bypass-hooks rule, context editing guidance
@e6qu e6qu force-pushed the feat/context-edit-v2 branch from 46a34e5 to 1510824 Compare March 15, 2026 21:13
@e6qu e6qu merged commit e0c348a into dev Mar 15, 2026
1 check passed
@e6qu e6qu deleted the feat/context-edit-v2 branch March 15, 2026 21:18
e6qu added a commit that referenced this pull request Mar 18, 2026
…ad distillation (#5)

Context editing improvements:
- query and toolName targeting for context_edit (no raw IDs needed)
- Lifecycle markers on parts: discardable, ephemeral, side-thread, pinned
- Deterministic sweeper auto-hides/externalizes expired markers
- Privileged agents (focus, compaction) can edit any message
- /reset-context command restores all edits from CAS

New tools:
- classifier_threads: classify messages by topic (main/side/mixed)
- distill_threads: classify + park side threads + store metadata

Agents:
- classifier: read-only, labels messages by topic (enabled by default)
- focus: label-driven cleanup (disabled by default, /focus command)
- focus-rewrite-history: full rewrite with user confirmation (disabled)
- All agents configurable via opencode.jsonc (model, disable)

Commands:
- /btw: side conversation via subagent
- /focus: classify + cleanup
- /focus-rewrite-history: full conversation rewrite
- /reset-context: undo all context edits from CAS

Config-based control (no feature toggles):
- Tools: set to false in tools config to disable
- Agents: set disable: true, override model per-agent

Documentation:
- docs/context-editing.md: tools, operations, lifecycle markers
- docs/schema.md: new tables, modified part fields
- docs/agents.md: classifier, focus, models, configuration
- Cleaned up research docs, cross-linked from README
- AGENTS.md: no-bypass-hooks rule, context editing guidance
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