Constitutional Agent Architecture Workflow
22 steps
Systematic workflow for creating/updating Claude Code plugin agents using constitutional AI and prompt engineering excellence
Triggers
Steps
- 1.
🧩 Assume Prompt Engineer Role
Activate constitutional prompt architecture expertise.
Use Adopt tool with roleId 'prompt-engineer' to activate The Prompt Architect cognitive framework with 10/10 constitutional AI capabilities.
⚠️ CRITICAL: This role provides systematic methodology, evidence-based optimization, and meta-cognitive scaffolding for perfect agent creation.
- 2.
📋 Define Agent Specifications
Establish clear constitutional architecture requirements for the target agent.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool to systematically analyze agent requirements.
Define: domain expertise, autonomous capabilities, constitutional principles, evaluation criteria, performance targets, tool requirements, and integration patterns. What specific intelligence amplification should this agent provide as an autonomous subprocess?
Output target: ~/.claude/agents/.md (globally auto-discovered, no registration needed).
Enhanced Thinking - 3.
🔍 Check Existing Agent
Determine if agent already exists and assess current implementation.
List all existing agent files in ~/.claude/agents/ to check for name conflicts. If the proposed agent name conflicts with an existing agent, choose a different name that avoids collision.
Also load the plugin-dev:plugin-structure skill and check installed plugins' agents/ directories for conflicts, since plugin-scoped agents share the namespace at runtime.
If the agent already exists in ~/.claude/agents/, read and analyze current implementation against 10/10 constitutional architecture standards.
⚠️ CRITICAL: Document gaps and enhancement opportunities for systematic improvement.
- 4.
🔬 Review Existing Agent Architecture
If agent exists, conduct comprehensive constitutional architecture analysis.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for systematic evaluation.
Evaluate against: constitutional coherence, architectural clarity, meta-cognitive scaffolding, context efficiency, failure resilience, dynamic adaptability. Apply 10/10 framework assessment.
Review: YAML frontmatter completeness (name, description with examples, model, color, tools), system prompt quality, triggering precision.
Enhanced Thinking - 5.
📚 Access Prompt Engineering Checklists
Load comprehensive evaluation frameworks from memory.
Search memory://prompt-engineering for all implementation checklists: GPT-4.1 System Prompt Patterns, Agentic Workflows, Instruction Following Framework, Chain of Thought Patterns, Error Handling Strategies, Performance Optimization.
⚠️ CRITICAL: These checklists provide 10/10 validation criteria.
- 6.
🔎 Research Domain Knowledge
Systematic research for agent domain expertise and patterns.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool to coordinate comprehensive research.
Research sequence:
- Search memory:// for existing domain knowledge using SearchMemories tool
- Search codebase for relevant implementation patterns
- Use context7 for current industry standards and best practices
- Document all findings in memory:// using WriteMemory with proper [[Wiki Links]] and tags
Enhanced Thinking - 7.
⚖️ Analyze Constitutional Requirements
Define constitutional AI principles and frameworks for the agent.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for constitutional analysis.
Design: core principles, anti-pattern recognition, value alignment mechanisms, evaluation criteria, and performance monitoring frameworks. How will this agent embed persistent constitutional thinking in its autonomous operation?
Enhanced Thinking - 8.
🏗️ Design Cognitive Architecture
Create systematic cognitive scaffolding and meta-cognitive frameworks for the agent's system prompt.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for architectural design.
Design: system prompt structure (role, responsibilities, process, output format, edge cases), tool selection strategy (least-privilege principle), triggering conditions and example blocks, context loading strategies, and quality frameworks.
Enhanced Thinking - 9.
🔨 Implement Agent Structure
Create complete agent markdown file with YAML frontmatter and constitutional system prompt.
Load the plugin-dev:agent-development skill as the canonical schema reference for agent file structure, frontmatter validation rules, tool options, color semantics, and system prompt patterns.
Implement YAML frontmatter: name (lowercase-hyphens, 3-50 chars), description (triggering conditions with 2-4 blocks including context/user/assistant/commentary), model (inherit|sonnet|opus|haiku), color (blue|cyan|green|yellow|magenta|red), tools (array, least-privilege).
Implement system prompt body: role description (second person), core responsibilities, analysis process, quality standards, output format, edge cases.
⚠️ CRITICAL: Follow exact Claude Code agent markdown schema with 10/10 constitutional integration.
- 10.
📊 Integrate Performance Monitoring
Add systematic performance measurement and optimization frameworks to the agent's system prompt.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for monitoring design.
Implement: specific KPI targets (>95% accuracy baselines), quality standards within the system prompt, self-validation protocols, and output format constraints. How will agent performance be measured and optimized?
Enhanced Thinking - 11.
📖 Add Documentation Framework
Implement comprehensive documentation and knowledge transfer systems within the agent's system prompt.
Add: output format templates, troubleshooting guidance with decision trees, edge case handling protocols, and maintenance specifications.
⚠️ CRITICAL: Enable systematic deployment and continuous improvement.
- 12.
💡 Implement Example Protocols
Create concrete triggering examples and demonstration frameworks with progressive complexity.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for example design.
Develop: 2-4 blocks in the description field showing context/user/assistant/commentary, progressive complexity models, anti-pattern illustrations, and edge case protocols. How will Claude know precisely when to trigger this agent?
Enhanced Thinking - 13.
🎯 Validate Against System Prompt Patterns
Systematic evaluation against GPT-4.1 System Prompt Patterns checklist.
Validate: three-pillar architecture, context management, tool integration, chain of thought integration, instruction following, error handling patterns. Document compliance score and enhancement opportunities.
⚠️ CRITICAL: Target 10/10 constitutional architecture score.
- 14.
🤖 Validate Against Agentic Workflows
Systematic evaluation against GPT-4.1 Agentic Workflows checklist.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for systematic validation.
Validate: three-pillar architecture, problem-solving workflows, meta-cognitive patterns, state management, tool integration, performance optimization. Does this agent enable autonomous intelligent behavior?
Enhanced Thinking - 15.
📋 Validate Against Instruction Following Framework
Systematic evaluation against Instruction Following Framework checklist.
Validate: structured instructions, example-driven guidance, conditional logic, meta-instruction framework, hierarchical architecture, behavioral consistency. Does this agent's system prompt provide clear, systematic guidance for autonomous operation?
- 16.
🔧 Validate Against Prompt Engineering Fundamentals
Systematic evaluation against Fundamentals Implementation checklist.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for comprehensive validation.
Validate: prompt structure architecture, template systems, variable frameworks, quality assurance, delimiter strategies, documentation standards. Does this agent demonstrate foundational excellence?
Enhanced Thinking - 17.
🛡️ Validate Against Error Handling Strategies
Systematic evaluation against Error Handling Strategies checklist.
Validate: failure mode detection, validation patterns, recovery procedures, preventive design, monitoring integration, graceful degradation. Does this agent prevent and handle systematic failures in its autonomous operation?
- 18.
🔗 Validate Against Chain of Thought Patterns
Systematic evaluation against Chain of Thought Patterns checklist.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for reasoning validation.
Validate: basic CoT templates, advanced reasoning, error analysis, quality enhancement, integration patterns, performance tracking. Does this agent enable systematic reasoning and meta-cognitive enhancement?
Enhanced Thinking - 19.
📈 Calculate Overall Constitutional Score
Compute comprehensive constitutional architecture score across all frameworks.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for systematic scoring.
Calculate scores for: constitutional coherence, architectural clarity, meta-cognitive scaffolding, context efficiency, failure resilience, dynamic adaptability. Target: 10/10 overall constitutional excellence.
Enhanced Thinking - 20.
⚡ Implement Enhancement Recommendations
Apply systematic improvements to achieve 10/10 constitutional architecture.
Implement all identified enhancements: missing frameworks, performance targets, system prompt refinements, example protocols, tool scope adjustments, validation mechanisms. Continue until 10/10 score achieved across all evaluation criteria.
⚠️ CRITICAL: No compromises on constitutional excellence.
- 21.
✅ Final Validation and Deployment
Comprehensive validation and agent deployment to the target plugin's agents/ directory.
🧠 ENHANCED THINKING REQUIRED: Use the SequentialThinking tool for final validation.
Validate: all checklists score 10/10, constitutional architecture complete, performance monitoring integrated, documentation comprehensive, examples clear, deployment ready.
Validate agent file structure: YAML frontmatter (name, description, model, color, tools), system prompt body (second person, responsibilities, process, output format, edge cases). Save to ~/.claude/agents/.md with proper markdown formatting. Create the directory if it does not exist.
Invoke the plugin-dev:plugin-validator agent to perform structural validation of the generated agent file within its target plugin context. This catches malformed frontmatter, missing required fields, and bad identifier patterns before deployment.
Enhanced Thinking - 22.
📝 Document Creation Methodology
Document the complete agent creation process and lessons learned.
Save to memory:// using WriteMemory: constitutional design patterns used, evaluation methodologies applied, enhancement techniques implemented, performance achievements, and process improvements for future agent creation.
⚠️ CRITICAL: Build institutional knowledge for systematic agent excellence.