Skip to content

P1-1: Create question-policy-before.ts plugin #143

@Cho-Geer

Description

@Cho-Geer

Parent Epic

#138 — Sub-Agent Question Propagation Fix

Phase 1 — Option B: Runtime Guard

Task

Create .opencode/plugins/question-policy-before.ts with tool.execute.before hook.

Design (from §6 Option B)

  • If input.tool !== "question", return (no-op).
  • Resolve agent/session via resolveAgent(input.sessionID), resolveTaskIdWithSource(input.sessionID), and session_map DB.
  • Treat session as subagent-scoped when: has dispatch dag_task_id, resolves from session_map/dispatch:child:*, agent mode is subagent, or is nested Knowledge-Curator session.
  • For subagent-scoped calls:
    • Write Log Central event SUBAGENT-QUESTION-BLOCKED.
    • Append durable record to .task_temp/{taskId}/questions.jsonl.
    • Throw actionable error telling subagent to write to HANDOVER.md.
  • Allow Orchestrator primary questions.
  • Allow Super-Admin only when not dispatched as child-session.

Framework Helpers to Use

  • withPluginLifecycle()
  • writeLog()
  • resolveAgent()
  • resolveTaskIdWithSource()
  • dbReadSessionMap() / session_map DB helpers

Reference

docs/review/framework-refactor/sub-agent-question-propagation-issue.md §6 Option B

Metadata

Metadata

Assignees

Labels

area/framework框架代码(.opencode/)bugSomething isn't workingdocumentationImprovements or additions to documentationp1Priority 1 - Highpriority-hightech-debt

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions