Skip to content

feat(prompt-session): own scan-first rule across CLI and MCP#68

Merged
derek-palmer merged 1 commit into
mainfrom
feat/prompt-session
May 29, 2026
Merged

feat(prompt-session): own scan-first rule across CLI and MCP#68
derek-palmer merged 1 commit into
mainfrom
feat/prompt-session

Conversation

@derek-palmer
Copy link
Copy Markdown
Owner

Summary

Extracts the duplicated scan-first enforcement and task lookup from the CLI and MCP adapters into a run-scoped PromptSession. Closes #49.

  • PromptSession owns the single scan-first rule, task lookup (via Task Registry), and bundle resolution; returns a structured Decision (Allowed/Denied with a Denial reason enum).
  • CLI and MCP become thin adapters: they inject their own scan_satisfied signal and translate Decisions into exit codes / JSON-RPC errors.
  • Rule is unified; scan-state signals deliberately are not (CLI keeps FORERUNNER_SCAN_DONE + config-gating). Recorded in docs/adr/0001.

Behavior change

MCP task validation now goes through the Task Registry instead of prompt-file existence, so unregistered stray prompt files are rejected. Registry ⊆ files is already enforced by tests, so registered tasks are unaffected.

Tests

  • New tests/test_prompt_session.py (TDD tracer → incremental).
  • Updated MCP serve tests to use registered task check; fixed one CLI patch target.
  • Full suite: 252 passed.

🤖 Generated with Claude Code

  Scan-first enforcement and task lookup were duplicated at the CLI and
  MCP edges and had drifted: CLI gated on config + FORERUNNER_SCAN_DONE
  and validated tasks against the registry, while MCP gated
  unconditionally and validated by prompt-file existence.

  Introduce a run-scoped PromptSession that owns the single scan-first
  rule, task lookup (via Task Registry), and bundle resolution, returning
  a structured Decision. Adapters translate Decisions into exit codes /
  JSON-RPC and still inject their own scan-satisfied signal, so observable
  CLI behavior is unchanged.

  MCP task validation now goes through the registry, so unregistered
  stray prompt files are rejected. Rationale for unifying the rule but
  not the signals recorded in docs/adr/0001.

  Closes #49
@derek-palmer derek-palmer merged commit ed97d79 into main May 29, 2026
10 checks passed
@derek-palmer derek-palmer deleted the feat/prompt-session branch May 29, 2026 03:25
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.

Deepen prompt execution behind a Prompt Session

1 participant