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
Parent Epic
#138 — Sub-Agent Question Propagation Fix
Phase 1 — Option B: Runtime Guard
Task
Create
.opencode/plugins/question-policy-before.tswithtool.execute.beforehook.Design (from §6 Option B)
input.tool !== "question", return (no-op).resolveAgent(input.sessionID),resolveTaskIdWithSource(input.sessionID), and session_map DB.dag_task_id, resolves fromsession_map/dispatch:child:*, agent mode issubagent, or is nestedKnowledge-Curatorsession.SUBAGENT-QUESTION-BLOCKED..task_temp/{taskId}/questions.jsonl.Orchestratorprimary questions.Super-Adminonly when not dispatched as child-session.Framework Helpers to Use
withPluginLifecycle()writeLog()resolveAgent()resolveTaskIdWithSource()dbReadSessionMap()/ session_map DB helpersReference
docs/review/framework-refactor/sub-agent-question-propagation-issue.md§6 Option B