feat(core,cli): M3c-rest — auto classifier mode + /init multi-phase#28
Merged
Conversation
· packages/core/src/auto-mode/index.ts (NEW, ~115 lines)
- classifyAutoMode({ toolName, toolInput, config, provider })
- Static order: hard_deny → allow → soft_deny → LLM classifier
- LLM call: tiny prompt + 8 tokens max + temperature=0; parses
"allow"/"deny"/anything-else→"ask". Falls back to config.fallback
(default 'ask') when no provider.
· packages/core/src/harness/tool-dispatcher.ts
- DispatchRequest gains autoMode + autoModeProvider.
- When mode === 'auto' AND no static rule matched, classifier verdict
drives decision (allow/deny/ask) before the hook chain.
· packages/core/src/agent.ts
- RunAgentOptions.autoMode passed through; classifier uses the agent's
provider (no extra config needed in the simple case).
· apps/cli/src/commands.ts + repl.ts
- /init now invokes ctx.initFlow (REPL-only).
- runInitFlow(): scan (top-level + package.json/README/etc) →
provider.runTurn drafts AGENTS.md → show first 40 lines → ask y/n →
write to <cwd>/AGENTS.md.
Tests: core 393 → 401 (+8: classifyAutoMode unit); cli 47 unchanged.
Total 440 → 448 passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto mode: static deny/allow/soft_deny first; LLM classifier (8 tokens, t=0) decides; fallback 'ask' default. Wired into dispatchToolCall + agent.ts + REPL/headless. /init now actually scans project, asks provider for AGENTS.md draft, prompts for approval. 8 new tests; 448 passing.