Skip to content

dojo CLI advancement wave 2 — blocking hooks, permissions, model routing, guardrails, external skills - #3

Merged
DojoGenesis merged 9 commits into
mainfrom
dojo-cli-advance-20260717
Jul 17, 2026
Merged

dojo CLI advancement wave 2 — blocking hooks, permissions, model routing, guardrails, external skills#3
DojoGenesis merged 9 commits into
mainfrom
dojo-cli-advance-20260717

Conversation

@DojoGenesis

Copy link
Copy Markdown
Owner

Orchestrated feature wave building on the merged overnight fest (#2). Four-source inspiration recon (Claude Code capability audit, Hermes/fleet-orchestration, Charm's Crush, workspace notes/ ACI-AXI research) → six tracks, contracts-first, strict per-file agent ownership.

What's in

  • Blocking hooks + UserPromptSubmitFireChecked contract distinguishes clean / non-blocking failure / blocked; per-rule "blocking": true (command-type hooks only); free-text chat now passes through a hook before reaching the Gateway, prompt delivered via DOJO_PROMPT env (4 KB cap, never shell-interpolated); prompt/agent hook types warn honestly instead of silently no-oping. (Claude Code PreToolUse/UserPromptSubmit)
  • Three-tier permissionspermissions.mode = default (confirm per action; refuses when non-TTY) / allowlist (dot-path globs in permissions.allowed) / yolo (--yolo, loud). Gates: code.undo, plugin.install, plugin.rm, craft.adr, craft.claude-md --fix, craft.scaffold. Single-prompt guarantee — the old ad-hoc confirms folded in; plugin rm gains a gate it never had. (Claude Code permission modes + Crush allowed_tools/--yolo)
  • Per-dispatch model routing/agent dispatch|chat --model <name>; precedence flag > delegation.model > Gateway default; /model ls shows the delegation default. Operationalizes the Sonnet-80/Opus-20 lane doctrine at the point of use. Forward-compat: Gateway may ignore the field today. (CC per-Task model + Hermes delegation split)
  • Advisory loop guardrail — consecutive identical failures of a slash command or same-signature chat-stream tool call print escalating advisories (warn 3 / hard 5, configurable); never blocks. (Hermes tool_loop_guardrails)
  • External skills interopskills.external_dirs (default .claude/skills) read-only SKILL.md discovery; /skill ls External section, /skill get ext:<name>; package-all never sweeps external dirs. /skill extracted verbatim from cmd_workflow.go into cmd_skill.go. (Crush Agent Skills + Hermes external_dirs)
  • Docs/craft suite documented for the first time (1,243-line file, 8 subcommands); stale Plugin System hooks example corrected (documented format never matched a real rule); dated CHANGELOG section.

Verification

  • make all (vet + full test suite with -race + build): green, all 23 testable packages
  • New-package tests additionally race-tested in isolation; 40+ new tests across 9 new test files, zero existing test files modified
  • Independent orchestrator verification: file inventory matches track ownership exactly; wiring greps positive; changed files gofmt-clean (8 files of pre-existing gofmt drift in untouched packages left alone)

Known residuals (deliberate)

  • StreamGuard watches the direct chat stream only, not /agent streams (documented as such) — candidate for next wave
  • craft memory prune / seed elevate keep their older confirm (Gateway-state mutations, not file writes — outside this wave's permission-key scope)
  • Deferred roadmap recorded in DGS-76: dojo mcp-server self-exposure, dojo serve daemon, LSP-fed context, Ctrl+L model picker, checkpoint/rewind + compaction (Gateway-owned), protocol re-injection drop-detection, /session <id> gateway verification

Fixes DGS-76

🤖 Generated with Claude Code

TresPies-source and others added 9 commits July 17, 2026 11:50
…nt wave

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…event

Fire() stays signature-stable for existing callers; FireChecked returns FireResult distinguishing clean / non-blocking failure / blocked. Only command-type hooks in rules marked blocking:true can block. UserPromptSubmit command hooks receive the prompt via DOJO_PROMPT env (4096-byte cap, never shell-interpolated). prompt/agent hook types now warn once per plugin instead of silently no-oping. Inspired by Claude Code PreToolUse/UserPromptSubmit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… agent streams

internal/guardrail Tracker counts consecutive identical failures per key; Dispatch prints escalating advisories (warn at 3, hard at 5, config guardrails.*), StreamGuard in the renderer flags repeated same-signature tool failures via the Warning path. Advisory-only, never blocks. Inspired by Hermes tool_loop_guardrails.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…m guard

PreCommand blocks now abort before Dispatch with [hooks] blocked message; free-text chat fires UserPromptSubmit before anything reaches the Gateway (a block returns to the prompt); StreamGuard observes the chat event stream. Carries the REPL wiring for both the hooks and guardrail tracks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
permissions.mode = default (confirm per action, refuses when non-TTY) | allowlist (permissions.allowed dot-path globs) | yolo (--yolo, loud). Gated: code.undo, plugin.install, plugin.rm, craft.adr, craft.claude-md --fix, craft.scaffold. Replaces the ad-hoc craftConfirm/InstallConfirmed prompts at those sites (single prompt, allowlist deny not overridable by --yes). Inspired by Claude Code permission modes + Crush allowed_tools/--yolo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
skills.external_dirs (default .claude/skills) is scanned read-only for Agent-Skills-convention SKILL.md files; /skill ls appends an External (read-only) section, /skill get ext:<name> forces external, plain get falls back on Gateway miss. /skill extracted verbatim from cmd_workflow.go into cmd_skill.go. package-all never sweeps external dirs. Inspired by Crush Agent Skills + Hermes external_dirs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/agent dispatch and /agent chat accept --model (both forms, any position); precedence flag > delegation.model > Gateway default; resolved model printed before streaming; /model ls shows the delegation default. Model field is forward-compat (Gateway may ignore today). Operationalizes the Sonnet-80/Opus-20 lane doctrine at the point of dispatch. Inspired by Claude Code per-Task model + Hermes delegation split.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e hooks example

README gains Craft Workbench, Permissions, and Guardrails sections plus config/env additions; Plugin System example corrected to the real hooks/hooks.json format (the old inline plugin.json form never matched a rule). CHANGELOG dated section for the wave with inspiration lineage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ayout

README tree showed 5 of ~25 internal packages, singular plugin/skill dirs, and a Cobra claim (the CLI uses its own command Registry, no Cobra). Both trees now enumerate the real packages with roles from their package doc comments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@DojoGenesis
DojoGenesis merged commit 3c195ae into main Jul 17, 2026
2 checks passed
@DojoGenesis
DojoGenesis deleted the dojo-cli-advance-20260717 branch July 17, 2026 18:29
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.

2 participants