-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathverify_agent_parser.py
More file actions
124 lines (102 loc) · 4 KB
/
verify_agent_parser.py
File metadata and controls
124 lines (102 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env python3
"""
Verification script for ADR-045 Task 3 enhanced agent parser.
Demonstrates parsing of agent profiles with new features:
- Capability descriptions
- Handoff patterns
- Constraints
- Preferences
- Primer matrix
- Default mode
"""
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.domain.doctrine.parsers import AgentParser
from src.domain.doctrine.models import Agent
def verify_enhanced_parser():
"""Verify enhanced agent parser features."""
print("=" * 80)
print("ADR-045 TASK 3 VERIFICATION - Enhanced Agent Profile Parser")
print("=" * 80)
print()
# Find a real agent file to parse
agent_files = [
Path("doctrine/agents/python-pedro.agent.md"),
Path("doctrine/agents/architect.agent.md"),
Path("tests/fixtures/doctrine/agents/test-agent.agent.md"),
]
parser = AgentParser()
for agent_file in agent_files:
if agent_file.exists():
print(f"📄 Parsing: {agent_file}")
print("-" * 80)
agent = parser.parse(agent_file)
# Display basic info
print(f"✅ Agent ID: {agent.id}")
print(f"✅ Name: {agent.name}")
print(f"✅ Default Mode: {agent.default_mode}")
print()
# Display capability descriptions
if agent.capability_descriptions:
print("📋 Capability Descriptions:")
for category, description in agent.capability_descriptions.items():
print(f" • {category.upper()}: {description[:60]}...")
print()
# Display handoff patterns
if agent.handoff_patterns:
print("🤝 Handoff Patterns:")
for pattern in agent.handoff_patterns[:3]: # First 3
print(
f" • {pattern.direction.upper()}: "
f"{pattern.source_agent} → {pattern.target_agent}"
)
if len(agent.handoff_patterns) > 3:
print(f" ... and {len(agent.handoff_patterns) - 3} more")
print()
# Display constraints
if agent.constraints:
print("⚠️ Constraints:")
for constraint in list(agent.constraints)[:3]: # First 3
print(f" • {constraint[:60]}...")
if len(agent.constraints) > 3:
print(f" ... and {len(agent.constraints) - 3} more")
print()
# Display preferences
if agent.preferences:
print("⚙️ Preferences:")
for key, value in list(agent.preferences.items())[:3]: # First 3
print(f" • {key}: {value}")
if len(agent.preferences) > 3:
print(f" ... and {len(agent.preferences) - 3} more")
print()
# Display primer matrix
if agent.primer_matrix:
print("🎯 Primer Matrix:")
for entry in agent.primer_matrix[:2]: # First 2
primers = ", ".join(sorted(entry.required_primers))
print(f" • {entry.task_type}: {primers}")
if len(agent.primer_matrix) > 2:
print(f" ... and {len(agent.primer_matrix) - 2} more")
print()
print("=" * 80)
print()
break # Only parse first available file
else:
print("❌ No agent files found for verification")
return False
print("✅ VERIFICATION COMPLETE")
print()
print("Enhanced features successfully parsed:")
print(" ✅ Capability descriptions")
print(" ✅ Handoff patterns")
print(" ✅ Constraints")
print(" ✅ Preferences")
print(" ✅ Primer matrix")
print(" ✅ Default mode")
print()
return True
if __name__ == "__main__":
success = verify_enhanced_parser()
sys.exit(0 if success else 1)