Annotates agent prompts with structural XML tags for comprehension, gap detection, and skill extraction...
Annotations create a comprehension and authoring layer for agent prompts. They are NOT for runtime composition—they enable:
| Tag | Purpose | Example Content |
|---|---|---|
<agent-identity> |
Who this agent is, one-sentence mission | "You are PAW-01A Specification Agent..." |
<core-principles> |
Container for guardrails, decision frameworks | Behavioral constraints section |
<guardrail> |
Rule that ALWAYS applies, constrains behavior | "Never include implementation details" |
<decision-framework> |
Logic for making choices | "When to skip research vs request it" |
<workflow> |
Container for sequenced steps | Main procedure section |
<workflow-step> |
One action in a sequence | "Step 3: Draft user stories" |
<artifact-format> |
Template/structure for outputs | Specification template, PR format |
<quality-gate> |
Criteria for "done" or "good enough" | Acceptance criteria checklist |
<handoff-instruction> |
What happens when agent completes | "Hand off to PAW-02A..." |
<communication-pattern> |
How to interact with user/other agents | "Use incremental writing pattern" |
<example> |
Concrete illustration of a concept | Sample output, good/bad comparison |
<classification-logic> |
Decision tree or categorization rules | "If X then Y, else Z" |
<context-requirement> |
What the agent needs to function | "Requires research artifact" |
<agent-identity>
<mission-statement>
<core-principles>
<guardrail>
<example>
<decision-framework>
<classification-logic>
<workflow>
<workflow-step>
<classification-logic>
<example>
<artifact-format>
<quality-gate>
<handoff-instruction>
<artifact-format>
Critical addition: Mark content as workflow-bound or reusable using the scope attribute.
| Phase-Specific | Phase-Agnostic | |
|---|---|---|
| Workflow-Controlling | Phase transitions, handoffs, stage gates | Mode selection, error recovery |
| Capability/Skill | Phase artifacts (Spec.md format) | General skills (review, summarize) |
| Value | Meaning | Example |
|---|---|---|
scope="reusable" |
Can be extracted and used in any agent | Deep review pattern, quality checks |
scope="phase-bound" |
Tied to this workflow phase | Spec template, handoff to PAW-02A |
scope="workflow" |
Controls workflow orchestration | Phase transition logic |
| (omitted) | Default, not yet classified | Most content initially |
> `<communication-pattern scope="reusable">`
**Deep Review Pattern**: When reviewing complex content, break into passes...
> `</communication-pattern>`
> `<handoff-instruction scope="phase-bound">`
Hand off to PAW-02A Code Researcher with the specification artifact.
> `</handoff-instruction>`
> `<guardrail scope="reusable">`
Never fabricate information. If uncertain, say so explicitly.
> `</guardrail>`
Before annotating, understand the agent's:
Use plain > prefix for all tags (nesting script adds depth markers):
> `<guardrail>`
Content here...
> `</guardrail>`
For each annotation, ask:
scope="reusable"scope="phase-bound"scope="workflow"If unsure, leave scope unspecified. Classification can be refined later.
python fix_xml_nesting.py <file.md>
Run the visualization script to generate structural views:
# Print all visualizations to stdout
python generate_viz.py <file.md>
# Write to output directory
python generate_viz.py <file.md> --output viz/
# Generate specific visualization only
python generate_viz.py <file.md> --mindmap # Mermaid mindmap
python generate_viz.py <file.md> --markmap # Interactive markmap
python generate_viz.py <file.md> --flow
python generate_viz.py <file.md> --summary
Viewing Markmap output (interactive with collapsible nodes):
markmap.markmap-vscode extension, open .mm.md filenpx markmap-cli <file>.mm.md -o <file>.htmlThe script generates skeletons. You must refine:
Shows annotation hierarchy as topic decomposition:
mindmap
root((Agent Name))
agent-identity
mission-statement
core-principles
guardrail: no fabrication [reusable]
guardrail: spec completeness [phase-bound]
workflow
workflow-step: intake
workflow-step: draft
handoff-instruction
Use for: "What topics does this agent cover?"
Shows workflow steps and handoffs:
flowchart TD
step1["Intake requirements"] --> step2["Draft specification"]
step2 --> step3["Quality check"]
step3 --> handoff1(["Hand off to PAW-02A"])
classDef phasebound fill:#f9f,stroke:#333
classDef handoff fill:#bbf,stroke:#333
Agent must add:
Use for: "How do topics sequence into action?"
Shows which guardrails apply to which workflow elements:
flowchart LR
subgraph Global
g1[No fabrication]
g2[Acknowledge uncertainty]
end
subgraph Phase-Specific
g3[Spec completeness]
g4[Testable requirements]
end
g1 --> step1[All steps]
g3 --> step2[Draft step]
g3 --> step3[Quality check]
Cannot be scripted — requires understanding which constraints affect which areas.
Use for: "What rules constrain this action?"
YAML output with counts and gap detection:
counts:
guardrails: 5
workflow_steps: 4
handoffs: 2
scope_breakdown:
reusable: 3
phase_bound: 4
unspecified: 2
potential_gaps:
- NOTE: No quality gates found
Use for: Quick structural overview, comparing agents.
> `<core-principles>`
## Core Principles
>- `<guardrail scope="reusable">`
**User value focus**: Describe WHAT & WHY, never implementation details
(no tech stack, file paths, library names, code snippets).
>- `</guardrail>`
>- `<guardrail scope="phase-bound">`
**Spec completeness**: Every requirement must be testable. Include
acceptance criteria for each user story.
>- `</guardrail>`
>- `<decision-framework scope="reusable">`
### When to Ask Clarifying Questions
- Ambiguous requirements → Ask
- Missing context that blocks progress → Ask
- Stylistic preferences → Make reasonable choice, note it
>- `</decision-framework>`
> `</core-principles>`
Don't tag every sentence. Tag meaningful sections:
Don't force content into a tag that doesn't fit:
<guardrail> because it mentions "should"<guidance> or leaving untagged if ambiguousDon't guess at scope if you're unsure:
scope="reusable" on everything that seems generalDon't annotate mechanically:
The visualization script (generate_viz.py) produces these outputs automatically:
-mindmap.mmd): Topic hierarchy from annotation nesting-by-section.mm.md): Interactive mindmap organized by document sections—preserves document structure-by-tag.mm.md): Interactive mindmap organized by tag type—shows fragmentation with ⚠️ warnings when same tag types appear in multiple sections-flow.mmd): Workflow steps + handoffs (refine with decisions)-summary.yaml): Counts, scope breakdown, fragmentation analysis, section overview, gap warningsMarkmap is recommended for navigation—click nodes to collapse/expand branches, zoom and pan.
The summary includes a Fragmentation Analysis section that identifies when annotations of the same type (e.g., <guardrail>) are scattered across multiple document sections. This helps detect:
Example fragmentation warning:
fragmented_tags:
guardrail: # appears in 5 sections
- "Core Principles & Guardrails" (10x)
- "Guardrails (Enforced)" (10x)
- "Error / Edge Handling" (1x)
- "High-Level Responsibilities" (1x)
- "Hand-off Checklist" (1x)
Agent-generated outputs:
Is it about WHO the agent is?
→ <agent-identity>
Is it a rule that ALWAYS applies?
→ <guardrail>
Is it logic for making a CHOICE?
→ <decision-framework> or <classification-logic>
Is it a STEP in a sequence?
→ <workflow-step>
Is it a TEMPLATE for output?
→ <artifact-format>
Is it about COMMUNICATION style?
→ <communication-pattern>
Is it a CHECKLIST for completion?
→ <quality-gate>
Is it about WHAT HAPPENS NEXT?
→ <handoff-instruction>
Is it a CONCRETE EXAMPLE?
→ <example>
Could ANY agent use this?
YES → scope="reusable"
Is this about THIS PHASE's specific outputs/transitions?
YES → scope="phase-bound"
Does this control WORKFLOW orchestration?
YES → scope="workflow"
Uncertain?
→ Leave scope unspecified