Task 7: AgentFrontmatter Enum Models
Status: NOT STARTED Agent: @python-cli-architect Dependencies: Task 2 Priority: 2 Complexity: S Accuracy Risk: High
Context
Existing AgentFrontmatter model (lines 1167-1235) lacks enum validation for model, permissionMode, and memory fields. Need to add enum types for strict validation.
Objective
Enhance AgentFrontmatter Pydantic model with enum validation for agent-specific fields.
Required Inputs
- Architecture spec: ./architect-plugin-linter.md lines 267-312 (Agent enum schema)
- Official docs: https://docs.anthropic.com/en/docs/claude-code/sub-agents.md (cite)
- Current AgentFrontmatter model: plugin_validator.py lines 1167-1235
Requirements
- Create
AgentModelStrEnum with values: SONNET, OPUS, HAIKU, INHERIT - Create
AgentPermissionModeStrEnum with 6 permission mode values - Create
AgentMemoryStrEnum with values: USER, PROJECT, LOCAL - Modify AgentFrontmatter model to use these enum types
- Change
model: str | Nonetomodel: AgentModel | None - Change
permissionMode: str | NonetopermissionMode: AgentPermissionMode | None - Add
memory: AgentMemory | Nonefield if not present
Constraints
- MUST cite official schema URL in enum docstrings
- MUST preserve all existing AgentFrontmatter fields unchanged
- MUST use exact enum value casing from official docs
- MUST NOT break existing agent frontmatter parsing
Expected Outputs
- Modified file:
plugins/plugin-creator/scripts/plugin_validator.py(lines 1167-1235 region) - 3 new StrEnum classes added
- AgentFrontmatter model fields updated to use enums
- Docstrings cite official schema URL
Acceptance Criteria
- AgentModel enum contains exactly 4 values (sonnet, opus, haiku, inherit)
- AgentPermissionMode enum contains all 6 permission modes
- AgentMemory enum contains 3 memory scope values
- AgentFrontmatter.model field type is
AgentModel | None - Existing agent files still validate correctly
- Invalid enum values rejected with Pydantic validation error
Verification Steps
- Parse existing agent .md files from codebase, verify no validation errors
- Create test agent with invalid model value "gpt-4", verify rejection
- Create test agent with invalid permissionMode, verify error suggests valid values
- Run
mypy --stricton modified file - Verify backward compatibility with existing tests
CoVe Checks
Accuracy Risk: High (must match official agent schema exactly)
Key claims to verify:
- All enum values match official documentation exactly
- Enum value casing is correct (lowercase vs camelCase)
- No valid enum values are missing
Verification questions:
- Are model values lowercase or capitalized in official schema?
- Is permissionMode camelCase or snake_case in official schema?
- Are there additional permission modes beyond the 6 listed?
- Is memory field actually supported in current Claude Code version?
Evidence to collect:
- Fetch official agent schema:
WebFetch("https://docs.anthropic.com/en/docs/claude-code/sub-agents.md") - Cross-reference all enum values with official list
- Test with actual agent files from this repository
- Check Claude Code version compatibility
- Fetch official agent schema:
Revision rule:
- If official schema has different enum values, update to match official
- If memory field is not in official schema, mark as experimental in docstring
- Document any version-specific enum values
Can Parallelize With: Task 4 (HookConfig), Task 5 (MCPConfig), Task 6 (LSPConfig) Reason: Independent schema enhancements Handoff: Provide model diff, verification outputs, official schema comparison