Skip to content

feat(cognition): dynamic persona tool surface from command AccessLevel - #1708

Merged
joelteply merged 1 commit into
canaryfrom
feat/dynamic-persona-tool-surface
Jun 21, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/dynamic-persona-tool-surface

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Dynamic, not hardcoded — the tool list is the command's own destiny

Replaces the anti-pattern I'd drifted into (a fixed with_tools(vec![read_tool()]) and a would-be hardcoded ACL prefix table) with the dynamic mechanism that was always intended — "all open, dynamic."

A persona's tools are now a pure function of command_registry() × access_level: every command that declares AccessLevel::AiSafe becomes a callable tool. A new ai-safe command appears → the persona can use it, zero code change. No hardcoded list, no parallel allow-table — the command's own access_level, surfaced through the one central listing, is the single source of truth.

  • ai_safe_tool_specs() — the persona's tools, derived live from the registry.
  • descriptor_to_tool_spec() — the projection. Description + schema are best-effort until commands declare richer tool-facing metadata (the next mechanism, in the command's own destiny); it lands here with no caller change. Open-by-default now.
  • tool_surface_report() — the anti-"tool vanished" diagnostic: included / excluded + the one reason (access_level). "Why isn't tool X here?" is a one-look answer, never a hunt for a scattered filter (the exact bug-class Joel called out).

Tests

  • Surface == the registry's AiSafe slice; included ∪ excluded == whole registry (no silent drops).
  • Projection preserves the command name verbatim (the executor dispatches on it).

Next

Wire ai_safe_tool_specs() into build_workspace_cycle (#15, so the live faculty actually gets them) + enrich descriptor metadata (description + param JSON schema) so the specs are richly self-describing.

🤖 Generated with Claude Code

A persona's tools are now DISCOVERED, never hardcoded. The surface is a pure
function of `command_registry() × access_level`: every command that declares
`AccessLevel::AiSafe` becomes a callable tool, a new ai-safe command appears
→ the persona can use it with zero code change. No hardcoded tool list, no
parallel allow-table — the command's own access_level (its destiny),
surfaced through the one central listing, is the single source of truth.

This replaces the anti-pattern (a fixed with_tools(vec![read_tool()]) and a
would-be hardcoded ACL prefix table) with the dynamic mechanism that was
always intended ("all open, dynamic").

- `ai_safe_tool_specs()` — the persona's tools, derived live from the registry.
- `descriptor_to_tool_spec()` — the projection; description + schema are
  best-effort until commands declare richer tool-facing metadata (the next
  mechanism, in the command's own destiny), which lands here with no caller
  change. Open-by-default now.
- `tool_surface_report()` — the anti-"tool vanished" diagnostic: included /
  excluded + the one reason (access_level), so "why isn't tool X here?" is a
  one-look answer, never a hunt for a scattered filter.

Tests: surface == registry AiSafe slice (no silent inclusion/exclusion;
included ∪ excluded == whole registry); projection preserves the command
name. Next: wire ai_safe_tool_specs() into build_workspace_cycle (#15) and
enrich descriptor metadata (description + param schema).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit 3a508c8 into canary Jun 21, 2026
4 checks passed
@joelteply
joelteply deleted the feat/dynamic-persona-tool-surface branch June 21, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant