guardian-framework 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +463 -0
  3. package/dist/cli.js +12958 -0
  4. package/dist/exports.js +12765 -0
  5. package/package.json +61 -0
  6. package/templates/languages/go-patterns.md +411 -0
  7. package/templates/languages/java-patterns.md +545 -0
  8. package/templates/languages/python-patterns.md +312 -0
  9. package/templates/languages/rust-patterns.md +232 -0
  10. package/templates/languages/typescript-patterns.md +313 -0
  11. package/templates/pi/INDEX.md +437 -0
  12. package/templates/pi/agent/AGENTS.md +166 -0
  13. package/templates/pi/agents/architecture-coordinator.md +40 -0
  14. package/templates/pi/agents/architecture-validator.md +36 -0
  15. package/templates/pi/agents/bootstrap-implementer.md +37 -0
  16. package/templates/pi/agents/issue-factory.md +31 -0
  17. package/templates/pi/agents/operations-validator.md +32 -0
  18. package/templates/pi/agents/security-validator.md +33 -0
  19. package/templates/pi/architecture/CHANGELOG.md +78 -0
  20. package/templates/pi/architecture/decisions/ADR-template.md +76 -0
  21. package/templates/pi/architecture/diagrams/system-overview.md +159 -0
  22. package/templates/pi/architecture/modules/module-template.md +152 -0
  23. package/templates/pi/context/checklists.md +91 -0
  24. package/templates/pi/context/domain-workflow.md +180 -0
  25. package/templates/pi/context/output-formats.md +135 -0
  26. package/templates/pi/context/patterns-base.md +47 -0
  27. package/templates/pi/context/patterns.md +38 -0
  28. package/templates/pi/context/project.md +88 -0
  29. package/templates/pi/domain/exploration.md +93 -0
  30. package/templates/pi/domain/ubiquitous-language.md +24 -0
  31. package/templates/pi/extensions/architect-lib/generators.ts +528 -0
  32. package/templates/pi/extensions/architect-lib/helpers.ts +344 -0
  33. package/templates/pi/extensions/architect-lib/types.ts +117 -0
  34. package/templates/pi/extensions/architect.ts +1425 -0
  35. package/templates/pi/extensions/ask-user-question.ts +579 -0
  36. package/templates/pi/extensions/bash-guard.ts +556 -0
  37. package/templates/pi/extensions/config-reload.ts +115 -0
  38. package/templates/pi/extensions/coordinator.ts +304 -0
  39. package/templates/pi/extensions/curator.ts +543 -0
  40. package/templates/pi/extensions/domain-explorer.ts +990 -0
  41. package/templates/pi/extensions/filechanges.ts +656 -0
  42. package/templates/pi/extensions/goal-loop.ts +717 -0
  43. package/templates/pi/extensions/hooks.ts +452 -0
  44. package/templates/pi/extensions/kanban.ts +547 -0
  45. package/templates/pi/extensions/pipeline.ts +1246 -0
  46. package/templates/pi/extensions/plan-mode.ts +209 -0
  47. package/templates/pi/extensions/project-scaffolder.ts +284 -0
  48. package/templates/pi/extensions/read-only-mode.ts +192 -0
  49. package/templates/pi/extensions/redaction.ts +128 -0
  50. package/templates/pi/extensions/session-persistence.ts +174 -0
  51. package/templates/pi/extensions/slash-commands.ts +229 -0
  52. package/templates/pi/extensions/snippets.ts +201 -0
  53. package/templates/pi/extensions/validation-runner.ts +100 -0
  54. package/templates/pi/github/agents/architecture-coordinator.agent.md +27 -0
  55. package/templates/pi/github/agents/architecture-validator.agent.md +20 -0
  56. package/templates/pi/github/agents/bootstrap-implementer.agent.md +20 -0
  57. package/templates/pi/github/agents/epic-planner.agent.md +70 -0
  58. package/templates/pi/github/agents/issue-factory.agent.md +20 -0
  59. package/templates/pi/github/agents/operations-validator.agent.md +20 -0
  60. package/templates/pi/github/agents/security-validator.agent.md +20 -0
  61. package/templates/pi/github/copilot/settings.json +16 -0
  62. package/templates/pi/github/copilot-instructions.md +155 -0
  63. package/templates/pi/github/instructions/architecture.instructions.md +71 -0
  64. package/templates/pi/github/instructions/validation.instructions.md +69 -0
  65. package/templates/pi/github/workflows/01-planning-workflow.md +75 -0
  66. package/templates/pi/github/workflows/02-issue-generation-workflow.md +69 -0
  67. package/templates/pi/github/workflows/03-implementation-workflow.md +80 -0
  68. package/templates/pi/github/workflows/04-validation-workflow.md +68 -0
  69. package/templates/pi/preflight_report.json +99 -0
  70. package/templates/pi/prompts/blueprint-update.md +262 -0
  71. package/templates/pi/prompts/blueprint-validate.md +218 -0
  72. package/templates/pi/prompts/bug-fix.md +50 -0
  73. package/templates/pi/prompts/ci-blueprint.md +131 -0
  74. package/templates/pi/prompts/context-refresh.md +258 -0
  75. package/templates/pi/prompts/epic-plan.md +356 -0
  76. package/templates/pi/prompts/epic-template.md +186 -0
  77. package/templates/pi/prompts/feature-development.md +131 -0
  78. package/templates/pi/prompts/git-issues.md +243 -0
  79. package/templates/pi/prompts/hotfix.md +71 -0
  80. package/templates/pi/prompts/issue-closeout.md +342 -0
  81. package/templates/pi/prompts/issue-draft.md +218 -0
  82. package/templates/pi/prompts/issue-implementation-series.md +173 -0
  83. package/templates/pi/prompts/issue-merge.md +372 -0
  84. package/templates/pi/prompts/issue-template-set.md +392 -0
  85. package/templates/pi/prompts/issue-template.md +207 -0
  86. package/templates/pi/prompts/pattern-extract.md +269 -0
  87. package/templates/pi/prompts/plan-to-issues.md +430 -0
  88. package/templates/pi/prompts/refactoring.md +82 -0
  89. package/templates/pi/prompts/scope-analyzer.md +254 -0
  90. package/templates/pi/prompts/sync-check.md +230 -0
  91. package/templates/pi/scripts/categorize-issues.sh +171 -0
  92. package/templates/pi/scripts/ci/check_architecture_conformance.sh +748 -0
  93. package/templates/pi/scripts/ci/check_planning_packet.py +228 -0
  94. package/templates/pi/scripts/ci/run_hardening_stages.sh +264 -0
  95. package/templates/pi/scripts/ci/run_preflight.sh +649 -0
  96. package/templates/pi/scripts/ci/run_stage.sh +193 -0
  97. package/templates/pi/scripts/ci/stage_docs_policy.sh +82 -0
  98. package/templates/pi/scripts/ci/stage_integration.sh +3 -0
  99. package/templates/pi/scripts/ci/stage_lint.sh +130 -0
  100. package/templates/pi/scripts/ci/stage_migration_verify.sh +3 -0
  101. package/templates/pi/scripts/ci/stage_package_build.sh +3 -0
  102. package/templates/pi/scripts/ci/stage_release_readiness.sh +3 -0
  103. package/templates/pi/scripts/ci/stage_remaining.sh +242 -0
  104. package/templates/pi/scripts/ci/stage_security.sh +3 -0
  105. package/templates/pi/scripts/ci/stage_static_analysis.sh +114 -0
  106. package/templates/pi/scripts/ci/stage_unit.sh +119 -0
  107. package/templates/pi/scripts/ci/validate_agent_output.py +181 -0
  108. package/templates/pi/scripts/ci/validate_agent_output.sh +243 -0
  109. package/templates/pi/scripts/create-feature-branch.sh +136 -0
  110. package/templates/pi/scripts/create-mr.sh +117 -0
  111. package/templates/pi/scripts/fetch-issues.sh +131 -0
  112. package/templates/pi/scripts/generate-architecture.sh +161 -0
  113. package/templates/pi/scripts/git/close-epic.sh +69 -0
  114. package/templates/pi/scripts/git/close-issue.sh +35 -0
  115. package/templates/pi/scripts/git/create-tracking-issue.sh +174 -0
  116. package/templates/pi/scripts/git/link-issue-to-epic.sh +51 -0
  117. package/templates/pi/scripts/git/update-tracking-issue.sh +66 -0
  118. package/templates/pi/scripts/languages/go/validate-architecture.sh +139 -0
  119. package/templates/pi/scripts/languages/go/validate-canonical.sh +129 -0
  120. package/templates/pi/scripts/languages/go/validate-ci.sh +132 -0
  121. package/templates/pi/scripts/languages/go/validate-integration.sh +156 -0
  122. package/templates/pi/scripts/languages/go/validate-operations.sh +146 -0
  123. package/templates/pi/scripts/languages/go/validate-security.sh +135 -0
  124. package/templates/pi/scripts/languages/go/validate-tests.sh +125 -0
  125. package/templates/pi/scripts/languages/java/validate-annotations.sh +185 -0
  126. package/templates/pi/scripts/languages/java/validate-architecture.sh +159 -0
  127. package/templates/pi/scripts/languages/java/validate-canonical.sh +114 -0
  128. package/templates/pi/scripts/languages/java/validate-ci.sh +269 -0
  129. package/templates/pi/scripts/languages/java/validate-integration.sh +149 -0
  130. package/templates/pi/scripts/languages/java/validate-operations.sh +142 -0
  131. package/templates/pi/scripts/languages/java/validate-security.sh +174 -0
  132. package/templates/pi/scripts/languages/java/validate-spring-architecture.sh +227 -0
  133. package/templates/pi/scripts/languages/java/validate-tests.sh +159 -0
  134. package/templates/pi/scripts/languages/python/validate-architecture.sh +99 -0
  135. package/templates/pi/scripts/languages/python/validate-canonical.sh +124 -0
  136. package/templates/pi/scripts/languages/python/validate-ci.sh +130 -0
  137. package/templates/pi/scripts/languages/python/validate-integration.sh +119 -0
  138. package/templates/pi/scripts/languages/python/validate-operations.sh +107 -0
  139. package/templates/pi/scripts/languages/python/validate-security.sh +68 -0
  140. package/templates/pi/scripts/languages/python/validate-tests.sh +102 -0
  141. package/templates/pi/scripts/languages/rust/validate-architecture.sh +188 -0
  142. package/templates/pi/scripts/languages/rust/validate-canonical.sh +146 -0
  143. package/templates/pi/scripts/languages/rust/validate-ci.sh +147 -0
  144. package/templates/pi/scripts/languages/rust/validate-integration.sh +149 -0
  145. package/templates/pi/scripts/languages/rust/validate-operations.sh +154 -0
  146. package/templates/pi/scripts/languages/rust/validate-security.sh +153 -0
  147. package/templates/pi/scripts/languages/rust/validate-tests.sh +150 -0
  148. package/templates/pi/scripts/languages/typescript/validate-architecture.sh +157 -0
  149. package/templates/pi/scripts/languages/typescript/validate-canonical.sh +135 -0
  150. package/templates/pi/scripts/languages/typescript/validate-ci.sh +244 -0
  151. package/templates/pi/scripts/languages/typescript/validate-integration.sh +166 -0
  152. package/templates/pi/scripts/languages/typescript/validate-operations.sh +162 -0
  153. package/templates/pi/scripts/languages/typescript/validate-security.sh +169 -0
  154. package/templates/pi/scripts/languages/typescript/validate-tests.sh +158 -0
  155. package/templates/pi/scripts/merge-mr.sh +95 -0
  156. package/templates/pi/scripts/mr-validation.sh +228 -0
  157. package/templates/pi/scripts/validate-architecture-readiness.sh +153 -0
  158. package/templates/pi/scripts/validate-architecture.sh +22 -0
  159. package/templates/pi/scripts/validate-canonical.sh +22 -0
  160. package/templates/pi/scripts/validate-ci.sh +37 -0
  161. package/templates/pi/scripts/validate-integration.sh +22 -0
  162. package/templates/pi/scripts/validate-operations.sh +22 -0
  163. package/templates/pi/scripts/validate-security.sh +22 -0
  164. package/templates/pi/scripts/validate-tests.sh +22 -0
  165. package/templates/pi/scripts/validate-ubiquitous-language.sh +291 -0
  166. package/templates/pi/scripts/validation-cache.sh +139 -0
  167. package/templates/pi/skills/agents/architecture-coordinator.md +178 -0
  168. package/templates/pi/skills/agents/architecture-generator.md +79 -0
  169. package/templates/pi/skills/agents/architecture-validator.md +74 -0
  170. package/templates/pi/skills/agents/ci-mr-validator.md +46 -0
  171. package/templates/pi/skills/agents/code-developer.md +76 -0
  172. package/templates/pi/skills/agents/commit.md +46 -0
  173. package/templates/pi/skills/agents/curator.md +71 -0
  174. package/templates/pi/skills/agents/debug.md +59 -0
  175. package/templates/pi/skills/agents/documentation-maintainer.md +36 -0
  176. package/templates/pi/skills/agents/goal-loop.md +125 -0
  177. package/templates/pi/skills/agents/hooks.md +122 -0
  178. package/templates/pi/skills/agents/integration-validator.md +35 -0
  179. package/templates/pi/skills/agents/issue-creator.md +75 -0
  180. package/templates/pi/skills/agents/issue-factory.md +143 -0
  181. package/templates/pi/skills/agents/kanban.md +85 -0
  182. package/templates/pi/skills/agents/land.md +59 -0
  183. package/templates/pi/skills/agents/operations-validator.md +43 -0
  184. package/templates/pi/skills/agents/pipeline.md +113 -0
  185. package/templates/pi/skills/agents/plan-mode.md +77 -0
  186. package/templates/pi/skills/agents/pull.md +40 -0
  187. package/templates/pi/skills/agents/push.md +41 -0
  188. package/templates/pi/skills/agents/security-validator.md +85 -0
  189. package/templates/pi/skills/agents/session-persistence.md +119 -0
  190. package/templates/pi/skills/agents/slash-commands.md +117 -0
  191. package/templates/pi/skills/agents/snippets.md +99 -0
  192. package/templates/pi/skills/agents/subagent-registry.md +78 -0
  193. package/templates/pi/skills/agents/test-validator.md +42 -0
  194. package/templates/pi/skills/validators/architecture-validator.md +43 -0
  195. package/templates/pi/skills/validators/ci-validator.md +27 -0
  196. package/templates/pi/skills/validators/context-compaction.md +73 -0
  197. package/templates/pi/skills/validators/integration-validator.md +38 -0
  198. package/templates/pi/skills/validators/model-registry.md +96 -0
  199. package/templates/pi/skills/validators/operations-validator.md +34 -0
  200. package/templates/pi/skills/validators/security-guards.md +72 -0
  201. package/templates/pi/skills/validators/security-validator.md +41 -0
  202. package/templates/pi/skills/validators/system-prompt-tiers.md +69 -0
  203. package/templates/pi/skills/validators/test-validator.md +33 -0
  204. package/templates/pi/types.ts +62 -0
  205. package/templates/pi/validators/README.md +93 -0
  206. package/templates/pi/validators/default.toml +209 -0
  207. package/templates/pi/validators/spring.toml +142 -0
  208. package/templates/pi/workpad.md +53 -0
  209. package/templates/project/java/Dockerfile +14 -0
  210. package/templates/project/java/README.md +40 -0
  211. package/templates/project/java/pom.xml +132 -0
  212. package/templates/project/typescript/Dockerfile +15 -0
  213. package/templates/project/typescript/README.md +29 -0
  214. package/templates/project/typescript/package.json +23 -0
  215. package/templates/project/typescript/tsconfig.json +21 -0
  216. package/templates/workflow.md +123 -0
@@ -0,0 +1,437 @@
1
+ # Guardian Agent Framework
2
+
3
+ **Version:** 1.2.0
4
+ **Status:** Template
5
+ **Architecture:** Pi-first
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This framework uses `.pi/` as the source of truth. Other formats (`.claude/`, `.opencode/`, `.agents/`, `.omp/`) are generated exports.
12
+
13
+ ---
14
+
15
+ ## Canonical Reference Requirement
16
+
17
+ **All implementation files must reference architecture documentation:**
18
+
19
+ ```typescript
20
+ /**
21
+ * Canonical Reference: .pi/architecture/modules/[module-name].md#[section]
22
+ * Implements: [spec/AC from architecture]
23
+ * Last Sync: [date from CHANGELOG]
24
+ */
25
+ ```
26
+
27
+ **Generated files must include source reference:**
28
+
29
+ ```markdown
30
+ <!--
31
+ Canonical Reference: .pi/[source-path].md
32
+ Generated: [timestamp]
33
+ DO NOT EDIT DIRECTLY - Modify source in .pi/
34
+ -->
35
+ ```
36
+
37
+ **Architecture changes require CHANGELOG entry:**
38
+
39
+ ```markdown
40
+ ## [date] - [Change Title]
41
+
42
+ ### Changed
43
+ - Module: [name]
44
+ - [what changed]
45
+
46
+ ### Impact
47
+ - Files affected: [list]
48
+ - Canonical refs to update: [list]
49
+ - Validators: [which to re-run]
50
+
51
+ ### Migration
52
+ [steps to update implementation]
53
+ ```
54
+
55
+ **Validation:** `validate-canonical.sh` checks reference integrity, coverage, and architecture sync status.
56
+
57
+ ---
58
+
59
+ ## Directory Structure
60
+
61
+ ```
62
+ .pi/
63
+ ├── agent/
64
+ │ └── AGENTS.md # Project instructions + workflow config (YAML front matter)
65
+ │
66
+ ├── architecture/ # Architecture documentation (NEW)
67
+ │ ├── modules/ # Module architecture docs
68
+ │ │ ├── auth-system.md
69
+ │ │ ├── data-layer.md
70
+ │ │ ├── api-gateway.md
71
+ │ │ └── [module-name].md
72
+ │ ├── diagrams/ # Architecture diagrams
73
+ │ │ ├── system-overview.md
74
+ │ │ └── data-flow.md
75
+ │ ├── CHANGELOG.md # Architecture change log (required)
76
+ │ └── decisions/ # Architecture Decision Records (ADR)
77
+ │ ├── ADR-template.md
78
+ │ ├── ADR-001-auth-strategy.md
79
+ │ └── ADR-002-database-choice.md
80
+ │
81
+ ├── context/
82
+ │ ├── project.md # Project facts, commands (template)
83
+ │ ├── patterns.md # Code templates (template)
84
+ │ ├── checklists.md # Validation checklists
85
+ │ └── output-formats.md # Report templates
86
+ │
87
+ ├── skills/
88
+ │ ├── agents/
89
+ │ │ ├── architecture-coordinator.md
90
+ │ │ ├── architecture-validator.md
91
+ │ │ ├── security-validator.md
92
+ │ │ ├── operations-validator.md
93
+ │ │ ├── test-validator.md
94
+ │ │ ├── integration-validator.md
95
+ │ │ ├── ci-mr-validator.md
96
+ │ │ ├── code-developer.md
97
+ │ │ ├── documentation-maintainer.md
98
+ │ │ ├── issue-creator.md
99
+ │ │ ├── commit.md # Clean, logical commits
100
+ │ │ ├── push.md # Keep remote branch current
101
+ │ │ ├── pull.md # Sync with latest main
102
+ │ │ ├── land.md # PR merge loop with validation
103
+ │ │ ├── debug.md # Systematic debugging
104
+ │ │ ├── subagent-registry.md # Delegated subagent system with tool scoping
105
+ │ │ ├── plan-mode.md # Queued edits for batch review
106
+ │ │ ├── snippets.md # Reusable #handle prompt fragments
107
+ │ │ └── session-persistence.md # Session lifecycle management
108
+ │ └── validators/
109
+ │ ├── architecture-validator.md
110
+ │ ├── security-validator.md
111
+ │ ├── security-guards.md # Path safety + command deny-list
112
+ │ ├── context-compaction.md # Token-aware context management
113
+ │ ├── system-prompt-tiers.md # Full/lite prompt tiers by model
114
+ │ ├── model-registry.md # Model capability scoring
115
+ │ ├── operations-validator.md
116
+ │ ├── integration-validator.md
117
+ │ ├── test-validator.md
118
+ │ └── ci-validator.md
119
+ │
120
+ ├── prompts/
121
+ │ ├── feature-development.md
122
+ │ ├── bug-fix.md
123
+ │ ├── hotfix.md
124
+ │ ├── refactoring.md
125
+ │ ├── issue-implementation-series.md
126
+ │ ├── epic-plan.md # Multi-module epic planning (overview + module slice)
127
+ │ ├── issue-draft.md # Create draft issues from epic
128
+ │ ├── git-issues.md # Create epics/issues in GitHub/GitLab
129
+ │ ├── issue-closeout.md # Validate + create compliance MR
130
+ │ ├── issue-merge.md # Merge MR + close issue + update tracking
131
+ │ ├── plan-to-issues.md # Convert superpowers plan to issues
132
+ │ ├── blueprint-validate.md # Validate blueprint integrity
133
+ │ ├── sync-check.md # Check exports in sync with blueprint
134
+ │ ├── context-refresh.md # Update context from codebase state
135
+ │ ├── scope-analyzer.md # Auto-determine scope classification
136
+ │ ├── pattern-extract.md # Extract patterns to blueprint
137
+ │ └── blueprint-update.md # Reverse-sync implementation to blueprint
138
+ │
139
+ ├── validators/ # TOML-based declarative validation rules
140
+ │ ├── default.toml # Built-in validators with inline tests
141
+ │ └── README.md # Validator documentation
142
+ ├── scripts/
143
+ │ ├── validate-ci.sh
144
+ │ ├── validate-tests.sh
145
+ │ ├── validate-operations.sh
146
+ │ ├── validate-security.sh
147
+ │ ├── validate-architecture.sh
148
+ │ ├── validate-canonical.sh # Canonical reference integrity
149
+ │ ├── validation-cache.sh
150
+ │ ├── fetch-issues.sh
151
+ │ ├── categorize-issues.sh
152
+ │ ├── create-feature-branch.sh
153
+ │ ├── create-mr.sh
154
+ │ ├── mr-validation.sh
155
+ │ └── merge-mr.sh
156
+ │
157
+ ├── extensions/
158
+ │ ├── validation-runner.ts # Pi extension for validation commands
159
+ │ ├── coordinator.ts # Pi extension for scope classification + validation tools
160
+ │ ├── bash-guard.ts # Destructive command blocking + path safety guards
161
+ │ ├── filechanges.ts # File change tracking with accept/decline
162
+ │ ├── read-only-mode.ts # Safe exploration mode (read/grep/find/ls only)
163
+ │ ├── ask-user-question.ts # Structured question tool (text/single/multi-select)
164
+ │ ├── config-reload.ts # Dynamic config reload on AGENTS.md change
165
+ │ ├── plan-mode.ts # Queued mutations for batch review (/plan)
166
+ │ ├── slash-commands.ts # /init, /validate, /scope, /snippet commands
167
+ │ ├── session-persistence.ts # Structured session lifecycle with auto-titling
168
+ │ ├── snippets.ts # #handle token expansion and management
169
+ │ └── redaction.ts # Automatic secret redaction in output
170
+ │
171
+ ├── workpad.md # Persistent session progress tracker
172
+ ├── github/ # GitHub Copilot CLI templates
173
+ │ ├── copilot-instructions.md # Main project instructions
174
+ │ ├── instructions/
175
+ │ │ ├── architecture.instructions.md
176
+ │ │ └── validation.instructions.md
177
+ │ ├── agents/
178
+ │ │ ├── architecture-coordinator.agent.md
179
+ │ │ └── epic-planner.agent.md
180
+ │ └── copilot/
181
+ │ └── settings.json # Copilot CLI settings
182
+ │
183
+ ├── INDEX.md # This file
184
+ └── README.md # Complete documentation
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Architecture Module Documentation
190
+
191
+ Each module in `.pi/architecture/modules/` follows this structure:
192
+
193
+ ```markdown
194
+ # [Module Name] Architecture
195
+
196
+ <!--
197
+ Canonical Reference: .pi/architecture/modules/[module-name].md
198
+ Source: Blueprint (do not modify implementation directly)
199
+ -->
200
+
201
+ ## Overview
202
+ [Module purpose and scope]
203
+
204
+ ## Components
205
+ | Component | File | Purpose |
206
+ |-----------|------|---------|
207
+ | [name] | src/[path] | [what it does] |
208
+
209
+ ## Data Flow
210
+ [How data moves through this module]
211
+
212
+ ## Dependencies
213
+ - Depends on: [other modules]
214
+ - Used by: [other modules]
215
+
216
+ ## Security Considerations
217
+ [Security requirements for this module]
218
+
219
+ ## Testing Requirements
220
+ [Unit, integration, e2e tests needed]
221
+
222
+ ## Change Log References
223
+ - 2026-04-26: [change] → see CHANGELOG.md#[section]
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Repository Tool
229
+
230
+ The framework supports both GitHub and GitLab:
231
+
232
+ | Tool | CLI | Platform |
233
+ |------|-----|----------|
234
+ | `gh` | GitHub CLI | GitHub.com |
235
+ | `glab` | GitLab CLI | GitLab.com or self-hosted |
236
+
237
+ Selected during `guardian init` and used in all git-related workflows.
238
+
239
+ ---
240
+
241
+ ## Agent Directory
242
+
243
+ | Agent | Role | When to Use | Mode |
244
+ |-------|------|-------------|------|
245
+ | `architecture-coordinator` | Master orchestrator | All tasks | primary |
246
+ | `architecture-validator` | Architecture check | Moderate+ scope | subagent |
247
+ | `security-validator` | Security check | Complex+ scope | subagent |
248
+ | `operations-validator` | Operations check | Plan review | subagent |
249
+ | `test-validator` | Test validation | Post-code | subagent |
250
+ | `integration-validator` | Integration check | Complex+ scope | subagent |
251
+ | `ci-validator` | CI/merge | All PRs (automated) | subagent |
252
+ | `code-developer` | Implementation | All code tasks | subagent |
253
+ | `issue-creator` | Issue tracking | All tasks | subagent |
254
+ | `documentation-maintainer` | Doc sync | Architecture changes | subagent |
255
+
256
+ ---
257
+
258
+ ## Scope Classification
259
+
260
+ | Scope | Files | Lines | Required Validators |
261
+ |-------|-------|-------|---------------------|
262
+ | Simple | 1 | < 50 | ci + canonical (automated) |
263
+ | Moderate | 2-5 | 50-200 | ci + architecture + canonical |
264
+ | Complex | 5-15 | 200-500 | ci + architecture + security + canonical |
265
+ | Critical | 15+ or core | 500+ | All validators + canonical + human approval |
266
+
267
+ ---
268
+
269
+ ## Automated Scripts
270
+
271
+ | Script | Checks |
272
+ |--------|--------|
273
+ | `validate-ci.sh` | Build, test, lint, format, audit |
274
+ | `validate-tests.sh` | Unit, integration, coverage |
275
+ | `validate-operations.sh` | Tracing, cancellation, atomic writes |
276
+ | `validate-security.sh` | Secrets, injection, path traversal |
277
+ | `validate-architecture.sh` | Architecture patterns, dependencies |
278
+ | `validate-canonical.sh` | Canonical reference integrity, coverage, architecture sync |
279
+ | `validation-cache.sh` | Retry optimization |
280
+
281
+ ---
282
+
283
+ ## Workflows
284
+
285
+ ### Standard Workflows
286
+
287
+ | Workflow | File | Use When |
288
+ |----------|------|----------|
289
+ | Feature Development | `prompts/feature-development.md` | New features |
290
+ | Bug Fix | `prompts/bug-fix.md` | Bug fixes |
291
+ | Emergency Hotfix | `prompts/hotfix.md` | Production issues |
292
+ | Refactoring | `prompts/refactoring.md` | Code improvement |
293
+ | Issue Implementation | `prompts/issue-implementation-series.md` | Batch implementation |
294
+
295
+ ### Epic/Issue Management Workflows
296
+
297
+ | Workflow | File | Purpose |
298
+ |----------|------|---------|
299
+ | Epic Plan (Overview) | `prompts/epic-plan.md` | Cross-module epic planning across all architectures |
300
+ | Epic Plan (Module Slice) | `prompts/epic-plan.md` | Module-specific epic planning from architecture doc |
301
+ | Epic Plan (Free-Form) | `prompts/epic-plan.md` | Quick single-feature planning |
302
+ | Issue Draft | `prompts/issue-draft.md` | Create draft issues from approved epic |
303
+ | Git Issues | `prompts/git-issues.md` | Create epics/milestones + issues + tracking in GitHub/GitLab |
304
+ | Issue Closeout | `prompts/issue-closeout.md` | Verify AC → validators → canonical → compliance MR |
305
+ | Issue Merge | `prompts/issue-merge.md` | Merge MR → close issue → update tracking → close epic |
306
+ | Plan to Issues | `prompts/plan-to-issues.md` | Convert superpowers plan to GitHub/GitLab issues |
307
+
308
+ ### Blueprint Management Workflows
309
+
310
+ | Workflow | File | Purpose |
311
+ |----------|------|---------|
312
+ | Blueprint Validate | `prompts/blueprint-validate.md` | Validate `.pi/` structure and integrity |
313
+ | Sync Check | `prompts/sync-check.md` | Verify exports match blueprint source |
314
+ | Context Refresh | `prompts/context-refresh.md` | Update context from codebase reality |
315
+ | Scope Analyzer | `prompts/scope-analyzer.md` | Auto-determine change scope + validators |
316
+ | Pattern Extract | `prompts/pattern-extract.md` | Extract patterns to `patterns.md` |
317
+ | Blueprint Update | `prompts/blueprint-update.md` | Reverse-sync implementation changes |
318
+
319
+ ### Workflow Sequence
320
+
321
+ ```
322
+ Blueprint Setup (one-time):
323
+ /blueprint-validate → /sync-check → [ready for implementation]
324
+
325
+ Multi-Module Planning (from scratch):
326
+ /epic-plan --overview → discover all modules, map dependencies, plan cross-module epics
327
+ → /issue-draft (per epic in dependency order)
328
+ → /git-issues → [implement] → /issue-closeout → /issue-merge
329
+
330
+ Single-Module Planning (targeted):
331
+ /epic-plan --module frontend docs/frontend-architecture.md
332
+ → analyze gap, slice next epic, validate
333
+ → /issue-draft → /git-issues → [implement] → /issue-closeout → /issue-merge
334
+
335
+ From Superpowers Plan:
336
+ /plan-to-issues → /git-issues → [implement] → /issue-closeout → /issue-merge
337
+ ↑ ↓
338
+ └────────────── next issue ────────────────┘
339
+
340
+ Maintenance:
341
+ /context-refresh → /pattern-extract → /blueprint-update → /sync-check → guardian generate
342
+ ```
343
+
344
+ ---
345
+
346
+ ## Implementation Phase Requirements
347
+
348
+ **All implementation phases must:**
349
+
350
+ 1. **Add canonical reference header** pointing to architecture module:
351
+ ```typescript
352
+ /**
353
+ * Canonical Reference: .pi/architecture/modules/[module].md#[section]
354
+ * Implements: [spec from architecture doc]
355
+ * Issue: #[issue-number]
356
+ */
357
+ ```
358
+
359
+ 2. **Check architecture CHANGELOG** for recent changes affecting the module
360
+
361
+ 3. **Reference specific sections** not just files: `.pi/architecture/modules/auth-system.md#token-validation`
362
+
363
+ ---
364
+
365
+ ## Validation Phase Requirements
366
+
367
+ **All validation phases must:**
368
+
369
+ 1. **Run canonical validator**: `bash .pi/scripts/validate-canonical.sh`
370
+
371
+ 2. **Check coverage**: Implementation files should have ≥50% canonical reference coverage
372
+
373
+ 3. **Verify architecture sync**: Check if CHANGELOG has pending changes affecting implementation
374
+
375
+ 4. **Validate accuracy**: References must point to existing architecture sections
376
+
377
+ 5. **Report gaps**: Files without references flagged, architecture changes needing sync
378
+
379
+ ---
380
+
381
+ ## Architecture Change Workflow
382
+
383
+ When architecture changes:
384
+
385
+ 1. **Update module doc**: `.pi/architecture/modules/[module].md`
386
+ 2. **Add CHANGELOG entry**: `.pi/architecture/CHANGELOG.md`
387
+ 3. **Identify impacted files**: List files needing canonical ref updates
388
+ 4. **Notify via workflow**: Run `/blueprint-update` after implementation
389
+ 5. **Validate sync**: Run `validate-canonical.sh` to verify updates
390
+
391
+ ---
392
+
393
+ ## Key Principles
394
+
395
+ 1. **Template-driven** - Workflows in templates, not dynamic generation
396
+ 2. **DAG-based** - Task nodes with dependencies, topological execution
397
+ 3. **Minimal LLM** - LLM = planning tool only
398
+ 4. **Bounded autonomy** - Hard caps on dynamic behavior
399
+ 5. **Bounded retries** - Max 3 retries with exponential backoff + jitter (±25%)
400
+ 6. **Risk-gated** - Safe=auto, Medium=confirm, Dangerous=dry-run
401
+ 7. **Pre-validated** - Validator catches errors BEFORE execution
402
+ 8. **Auditable** - Planning decisions tracked and diffable
403
+ 9. **Architecture-traced** - All code linked to architecture documentation
404
+ 10. **Change-log-governed** - Architecture changes tracked, migrations documented
405
+
406
+ ---
407
+
408
+ ## Generation Mappings
409
+
410
+ When running `guardian-framework generate`, `.pi/` files are transformed:
411
+
412
+ | Source | Destination | Transformation |
413
+ |--------|-------------|----------------|
414
+ | `AGENTS.md` | `.claude/CLAUDE.md`, `.opencode/context.md` | Direct copy + canonical header |
415
+ | `AGENTS.md` | `.github/copilot-instructions.md` | YAML frontmatter + canonical header |
416
+ | `architecture/modules/*.md` | `.claude/architecture/*.md` | Direct copy + canonical header |
417
+ | `architecture/CHANGELOG.md` | `.claude/architecture/CHANGELOG.md` | Direct copy |
418
+ | `skills/agents/*.md` | `.claude/agents/*.md`, `.github/agents/*.agent.md` | Direct copy + YAML frontmatter |
419
+ | `skills/validators/*.md` | `.opencode/prompts/*.txt` | Convert to .txt, compress |
420
+ | `context/*.md` | `.claude/context/*.md`, `.opencode/context/*.md` | Direct copy + canonical header |
421
+ | `context/*.md` | `.github/instructions/*.instructions.md` | YAML frontmatter + canonical header |
422
+ | `prompts/*.md` | `.opencode/workflows/*.md` | Nest under workflows/ |
423
+ | `scripts/*.sh` | `.pi/scripts/*.sh`, `.pi/scripts/*.sh` | Direct copy |
424
+ | `extensions/*.ts` | `extensions/*.ts` (pi only) | No export |
425
+ | `github/copilot/settings.json` | `.github/copilot/settings.json` | Direct copy |
426
+
427
+ ---
428
+
429
+ ## Language Patterns
430
+
431
+ Language-specific code patterns are stored in `templates/languages/`:
432
+ - `rust-patterns.md`
433
+ - `typescript-patterns.md`
434
+ - `python-patterns.md`
435
+ - `go-patterns.md`
436
+
437
+ Selected during `guardian init` based on project language.
@@ -0,0 +1,166 @@
1
+ ---
2
+ # Guardian Workflow Configuration
3
+ # YAML front matter = runtime settings. Body = agent prompt.
4
+ # Changes to this file are detected and re-applied without restart.
5
+
6
+ workspace:
7
+ root: ".pi/workspaces"
8
+ hooks:
9
+ timeout_ms: 60000
10
+
11
+ agent:
12
+ max_turns: 20
13
+ max_retry_backoff_ms: 300000
14
+ stall_timeout_ms: 300000
15
+
16
+ system_prompt_tier: full
17
+
18
+ generate:
19
+ on_conflict: warn
20
+ atomic_writes: true
21
+
22
+ validate:
23
+ fail_fast: false
24
+ timeout_ms: 300000
25
+
26
+ goal:
27
+ enabled: true
28
+ max_turns: 20
29
+ judge_validator: true
30
+
31
+ kanban:
32
+ enabled: true
33
+ auto_create_tasks: true
34
+
35
+ hooks:
36
+ pre_tool_call: []
37
+ post_tool_call: []
38
+ pre_llm_call: []
39
+ post_llm_call: []
40
+ on_session_start: []
41
+ on_session_end: []
42
+ subagent_stop: []
43
+
44
+ curator:
45
+ enabled: true
46
+ stale_after_days: 30
47
+ archive_after_days: 90
48
+ auto_review: true
49
+
50
+ delegation:
51
+ max_spawn_depth: 1
52
+ max_concurrent_children: 3
53
+ max_iterations: 50
54
+ child_timeout_ms: 600000
55
+ ---
56
+
57
+ # Project Context
58
+
59
+ > **Purpose:** Single source of truth for project-specific knowledge. All agents load this ONCE.
60
+ > **Customize:** Fill in the sections below for your project. The YAML front matter above already has working defaults.
61
+
62
+ ## Project Overview
63
+
64
+ - **Name:** [Project Name]
65
+ - **Version:** 0.1.0
66
+ - **Language:** [TypeScript / Python / Rust / Go]
67
+ - **Type:** [CLI / Web App / Library]
68
+ - **Repository:** [owner/repo]
69
+
70
+ ## Core Principles
71
+
72
+ > These are loaded into EVERY agent's context. Keep to 5-8 items.
73
+
74
+ 1. **Read before edit** — Always read a file before modifying it. Never mutate blindly.
75
+ 2. **Validate early** — Run `bash .pi/scripts/ci/run_preflight.sh` before committing.
76
+ 3. **Architecture traceability** — Every implementation file must reference its architecture source in `.pi/architecture/modules/`.
77
+ 4. **DRY context** — Shared knowledge lives in `.pi/context/`, not scattered across agent files.
78
+ 5. **Shift-left validation** — Plans are validated before code is written.
79
+
80
+ ## Commands
81
+
82
+ > Essential commands agents need to run. Update these for your project.
83
+
84
+ | Command | Purpose |
85
+ |---------|---------|
86
+ | `[build command]` | Build project |
87
+ | `[test command]` | Run tests |
88
+ | `[lint command]` | Lint check |
89
+ | `bash .pi/scripts/ci/run_preflight.sh` | Run local preflight checks |
90
+ | `bash .pi/scripts/validate-*.sh` | Run specific validator |
91
+
92
+ ## Architecture
93
+
94
+ ### Structure
95
+
96
+ ```
97
+ [project]/
98
+ ├── src/ # Source code
99
+ ├── tests/ # Test files
100
+ ├── docs/ # Documentation
101
+ └── [other dirs]
102
+ ```
103
+
104
+ ### Key Files
105
+
106
+ > Files every agent should know about. Keep under 10.
107
+
108
+ | File | Purpose |
109
+ |------|---------|
110
+ | `.pi/architecture/modules/` | Canonical architecture modules |
111
+ | `.pi/agent/AGENTS.md` | This file — project context + runtime config |
112
+ | `.pi/scripts/` | Validation scripts |
113
+ | `.pi/extensions/` | Pi extensions (tools, commands, hooks) |
114
+
115
+ ## Quality Gates
116
+
117
+ ### Before Commit
118
+
119
+ ```bash
120
+ bash .pi/scripts/ci/run_preflight.sh
121
+ [build command]
122
+ ```
123
+
124
+ ### Before Push
125
+
126
+ ```bash
127
+ [test command]
128
+ [lint command]
129
+ ```
130
+
131
+ ## Subagent Delegation
132
+
133
+ | Task | Subagent | Tools |
134
+ |------|----------|-------|
135
+ | Explore codebase | `explore` | read-only (read, grep, glob) |
136
+ | Code review | `code-review` | read-only (read, grep, glob) |
137
+ | Security audit | `security-review` | read-only (read, grep, glob) |
138
+
139
+ Subagents have **restricted tool access** and **fresh context**. Include all relevant context in the spawn prompt.
140
+
141
+ ## Snippets
142
+
143
+ Available `#handle` tokens for quick instruction injection:
144
+
145
+ | Handle | Purpose |
146
+ |--------|---------|
147
+ | `#security-review` | Security audit instructions |
148
+ | `#no-comments` | Suppress comments unless WHY is non-obvious |
149
+ | `#test-first` | TDD workflow instructions |
150
+
151
+ ## Environment
152
+
153
+ > Variables agents may reference. Use `$VAR_NAME` in scripts.
154
+
155
+ | Variable | Purpose |
156
+ |----------|---------|
157
+ | `$GITHUB_TOKEN` | GitHub API authentication |
158
+ | `$CI` | CI environment indicator |
159
+
160
+ ## Security Guards
161
+
162
+ Path safety guards are enforced by extensions (`.pi/extensions/bash-guard.ts`):
163
+
164
+ - **Read blocklist:** `.env*`, `*.pem`, `*.key`, `.ssh/*`, `.aws/*`, `.git/*`
165
+ - **Write blocklist:** Inherits read restrictions + `/etc/`, `/System/`, `/private/`
166
+ - **Command deny-list:** `rm -rf /`, `mkfs`, `dd of=/dev/*`, `terraform destroy`, `kubectl delete`
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: Architecture Coordinator
3
+ role: coordinator
4
+ ---
5
+
6
+ # Architecture Coordinator
7
+
8
+ ## Purpose
9
+ Turn a goal into a bounded execution stream with explicit issue order, controls, and forbidden shortcuts. Owns Phase A (Planning) of the delivery pipeline. Decides what work will be done and in what order.
10
+
11
+ ## Authority
12
+ **May:** Define scope boundaries, classify stream type (feature/hardening/migration/control), build dependency graphs, assign validators, select CI gates, decide the first implementation issue.
13
+ **May not:** Implement code, invent architecture that contradicts ADRs, skip mandatory validators, produce issues (that's Issue Factory's job).
14
+
15
+ ## Inputs
16
+ - Business goal or feature request
17
+ - `.pi/architecture/modules/` — module architecture docs (read impacted modules only)
18
+ - `.pi/architecture/decisions/` — ADRs (read all relevant accepted/proposed)
19
+ - `.pi/architecture/CHANGELOG.md` — recent architecture changes
20
+ - `.pi/context/project.md` — project knowledge and constraints
21
+ - `.pi/domain/exploration.md` — domain exploration output (when available)
22
+
23
+ ## Outputs
24
+ A planning packet containing:
25
+ - Stream classification (feature/hardening/migration/control)
26
+ - Scope summary with explicit in-scope and out-of-scope boundaries
27
+ - Impacted layers/modules checklist
28
+ - Risk classification (low/medium/high) with justification
29
+ - Dependency graph with execution order
30
+ - Mandatory validators list (at minimum: architecture-validator)
31
+ - Mandatory CI gates list
32
+ - Forbidden shortcuts
33
+ - First implementation issue recommendation
34
+ - Open questions and escalation items
35
+
36
+ ## Definition of Done
37
+ Done when a downstream agent (Issue Factory) can create epics and issues without ambiguity. The planning packet must pass `check_planning_packet.py` deterministic validation before handoff.
38
+
39
+ ## Escalation Rule
40
+ If canonical docs conflict, scope is unclear, or impacted layers can't be identified with confidence, stop and raise the gap. Do not smooth over ambiguity to produce a packet faster.
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: Architecture Validator
3
+ role: validator
4
+ ---
5
+
6
+ # Architecture Validator
7
+
8
+ ## Purpose
9
+ Verify issue/epic output against architecture policy before merge. Owns the architecture review in Phase D (Validation). Ensures implementation matches what was planned and no architecture drift occurred.
10
+
11
+ ## Authority
12
+ **May:** Pass, pass-with-recommendations, or fail an implementation based on architecture conformance. Require changes before merge approval.
13
+ **May not:** Redefine scope, add new requirements, implement code, override security or operations findings.
14
+
15
+ ## Inputs
16
+ - Planning packet from Phase A (for reference on approved scope)
17
+ - Implementation diff from Phase C
18
+ - Implementation report from Bootstrap Implementer
19
+ - Canonical references cited in the issue
20
+ - `.pi/architecture/modules/` — relevant module docs
21
+ - `.pi/architecture/decisions/` — relevant ADRs
22
+
23
+ ## Outputs
24
+ A validation report containing:
25
+ - Decision (pass / pass_with_recommendations / fail)
26
+ - Blocking findings (must fix before proceeding)
27
+ - Non-blocking recommendations
28
+ - Section reference verification (citations support claims)
29
+ - Acceptance criteria verification (each AC evaluated with evidence)
30
+ - Final disposition (approved as-is / approved with minor recommendations / blocked)
31
+
32
+ ## Definition of Done
33
+ Done when the validation report is complete, all blocking findings are either resolved or escalated, and the issue is ready for the next phase (security/operations validation or merge).
34
+
35
+ ## Escalation Rule
36
+ If the implementation contradicts approved ADRs or module architecture without documented rationale, block and escalate to Architecture Coordinator. Do not approve architecture drift silently.