Skip to content

✨ Add subagent frontmatter to agent action definitions - #84

Merged
monkut merged 1 commit into
mainfrom
feature/80-agent-frontmatter
Apr 25, 2026
Merged

✨ Add subagent frontmatter to agent action definitions#84
monkut merged 1 commit into
mainfrom
feature/80-agent-frontmatter

Conversation

@monkut

@monkut monkut commented Apr 25, 2026

Copy link
Copy Markdown
Owner

Closes via review: refs #80

Summary

Adopts a Claude Code subagent–style YAML frontmatter on each *_SYSTEM_PROMPT.md template so per-action tool surface, model, and reasoning effort are declarative instead of uniform.

  • AgentConfig gains optional fields: tools, disallowed_tools, model, effort, max_thinking_tokens, max_turns
  • Stdlib-only frontmatter parser (no new runtime deps); validates enum fields (model, effort) at load time with clear errors
  • load_agent_config splits frontmatter from body; templates without frontmatter continue to work unchanged (back-compat)
  • ClaudeRunner translates AgentConfig fields into --model, --allowedTools, --disallowedTools, --max-turns
  • CLI precedence (highest wins): explicit CLI flag > env var > template frontmatter > built-in default
  • Per-action defaults match the issue's table:
Action tools model effort
prepare Read, Grep, Glob, Bash(gh:*) sonnet medium
plan Read, Grep, Glob, Bash(gh:*) opus high
develop Read, Write, Edit, Bash, Grep, Glob opus max
issue-review Read, Grep, Glob, Bash(gh:*) sonnet medium
pr-review Read, Grep, Glob, Bash(gh:*,git:*) opus high
explore Read, Grep, Glob, Bash(gh:*) sonnet high
diagnose Read, Grep, Glob, Bash(gh:*,git:*) sonnet high
fix-ci Read, Write, Edit, Bash, Grep, Glob sonnet high
  • Bumps version to 0.2.6

Notes

  • permission_mode is intentionally not exposed in AgentConfig or per-action defaults. askcc runs claude with --dangerously-skip-permissions so the one-shot subprocess can execute unattended; if any permission check were to trigger, the run would deadlock with no human to answer the prompt. The per-action tools allowlist is the safety boundary instead.
  • A code comment near DEVELOP_AGENT_PROMPT and FIXCI_AGENT_PROMPT explains why those write-capable agents specifically need the broad Edit/Write/Bash allowlist.
  • Frontmatter parser is ~30 lines of stdlib code; project's dependencies = [] stance preserved.

Key Flows

flowchart TD
    A[load_agent_config action] --> B[load_template *_SYSTEM_PROMPT.md]
    B --> C{starts with '---'?}
    C -- no --> D[return AgentConfig with body as system_prompt]
    C -- yes --> E[parse_frontmatter]
    E --> F{valid model/effort?}
    F -- no --> G[raise ValueError with allowed values]
    F -- yes --> H[override AgentConfig fields]
    H --> I[return AgentConfig with body and frontmatter overrides]
Loading
flowchart TD
    A[CLI arg --effort] --> B{explicit?}
    B -- yes --> Z[use CLI value]
    B -- no --> C{env ASKCC_CLAUDE_EFFORT_LEVEL set and valid?}
    C -- yes --> Y[use env value]
    C -- no --> D{frontmatter effort set?}
    D -- yes --> X[use frontmatter value]
    D -- no --> W[use DEFAULT_EFFORT_LEVEL]
Loading

Verification

  • `uv run poe check` (ruff) — passed
  • `uv run poe typecheck` (pyright) — 0 errors
  • `uv run poe test` — 178 passed (155 existing + 23 new across TestParseFrontmatter, TestLoadAgentConfigFrontmatter, TestEffortPrecedence, TestRunnerFrontmatterFlags)

Test plan

  • Frontmatter parser: happy path, list/int coercion, invalid model, invalid effort, invalid int, unclosed delimiter, unknown key warning, blank/comment lines
  • load_agent_config: default templates yield frontmatter fields, no-frontmatter back-compat, user-frontmatter override, invalid frontmatter raises at load
  • CLI precedence: CLI > env > frontmatter > default
  • Runner emits --model, --allowedTools, --disallowedTools, --max-turns from AgentConfig; no flags emitted when fields unset
  • Existing tests for effort/thinking flow still pass

Adopts a Claude Code subagent-style YAML frontmatter on each
*_SYSTEM_PROMPT.md template so per-action tool surface, model, and
reasoning effort are declarative rather than uniform.

- AgentConfig gains optional fields: tools, disallowed_tools, model,
  effort, max_thinking_tokens, max_turns
- Stdlib-only frontmatter parser (no new runtime deps); validates enum
  fields (model, effort) at load time with clear errors
- load_agent_config splits frontmatter from body; templates without
  frontmatter continue to work unchanged (back-compat)
- ClaudeRunner emits --model, --allowedTools, --disallowedTools,
  --max-turns from AgentConfig
- CLI precedence (highest wins): explicit CLI > env > frontmatter >
  built-in default
- Per-action defaults match the issue's table; permission_mode is
  intentionally not exposed since askcc runs unattended with
  --dangerously-skip-permissions (the tools allowlist is the per-action
  safety boundary)
- Bumps version to 0.2.6
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.

1 participant