Repository navigation
feat(cognition): dynamic persona tool surface from command AccessLevel - #1708
Merged
Merged
Conversation
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]>
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.
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 declaresAccessLevel::AiSafebecomes 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 ownaccess_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
included ∪ excluded == whole registry(no silent drops).Next
Wire
ai_safe_tool_specs()intobuild_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