Skip to content

feat: live stack-state injection via agent harness hook #304

Description

@aarontrowbridge

What

The agent's system prompt currently gets solver mode and routing guidance only at file-generation time (boot / solver-switch / vault-respawn). This adds a second opencode plugin (amicode_context.ts) implementing experimental.chat.system.transform that reads the live filesystem state on every prompt build and injects a ## Stack state (live) block.

Changes

  • opencode-plugin/stack_state.ts — standalone state readers + markdown builders (solver mode, routing, active problem, live runs), node-builtins only for Bun runtime
  • opencode-plugin/amicode_context.ts — new plugin, single export, one hook
  • src/opencode_config.ts — removed solver/routing from AGENTS.md file splice (replaced with recovery pointer); buildOpencodeConfigContent accepts extraPluginPaths param
  • src/extension.ts — boot + solver-switch both register the context plugin; solver-switch now passes projectDir (fixes mkdtemp asymmetry bug)
  • ~/.amico/server/opencode-config-content.json — context plugin registered for launchd server
  • packages/extension/AGENTS.md — recovery pointer appended

Verification

Typecheck clean, all 909 tests pass (85 test files).

Metadata

Metadata

Assignees

No one assigned

    Labels

    hitlHuman-in-the-loop — needs human review/decision

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions