ahead-pi 0.2.0 → 0.3.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 (102) hide show
  1. package/README.md +29 -9
  2. package/dist/ahead_wasm.wasm +0 -0
  3. package/generated/corrective-debugging/ai-audit.md +39 -0
  4. package/generated/corrective-debugging/ai-review.md +46 -0
  5. package/generated/corrective-debugging/characterize.md +53 -0
  6. package/generated/corrective-debugging/conclude.md +59 -0
  7. package/generated/corrective-debugging/correction.md +53 -0
  8. package/generated/corrective-debugging/deploy.md +38 -0
  9. package/generated/corrective-debugging/human-review.md +45 -0
  10. package/generated/corrective-debugging/implement.md +42 -0
  11. package/generated/corrective-debugging/investigate.md +59 -0
  12. package/generated/corrective-debugging/manifest.json +30 -0
  13. package/generated/corrective-debugging/model.md +53 -0
  14. package/generated/corrective-debugging/outcome.md +38 -0
  15. package/generated/corrective-debugging/plan.md +53 -0
  16. package/generated/corrective-debugging/verify.md +47 -0
  17. package/generated/decision/compare.md +45 -0
  18. package/generated/decision/criteria.md +45 -0
  19. package/generated/decision/decide.md +45 -0
  20. package/generated/decision/frame.md +45 -0
  21. package/generated/decision/manifest.json +21 -0
  22. package/generated/decision/options.md +47 -0
  23. package/generated/decision/publish.md +38 -0
  24. package/generated/decision/research.md +45 -0
  25. package/generated/internal-improvement/ai-audit.md +39 -0
  26. package/generated/internal-improvement/ai-review.md +46 -0
  27. package/generated/internal-improvement/baseline.md +46 -0
  28. package/generated/internal-improvement/decision.md +45 -0
  29. package/generated/internal-improvement/deploy.md +38 -0
  30. package/generated/internal-improvement/human-review.md +45 -0
  31. package/generated/internal-improvement/implement.md +42 -0
  32. package/generated/internal-improvement/invariants.md +38 -0
  33. package/generated/internal-improvement/manifest.json +29 -0
  34. package/generated/internal-improvement/options.md +47 -0
  35. package/generated/internal-improvement/outcome.md +38 -0
  36. package/generated/internal-improvement/plan.md +53 -0
  37. package/generated/internal-improvement/target.md +45 -0
  38. package/generated/internal-improvement/verify.md +45 -0
  39. package/generated/investigation/bound.md +45 -0
  40. package/generated/investigation/conclude.md +45 -0
  41. package/generated/investigation/explore.md +60 -0
  42. package/generated/investigation/frame.md +45 -0
  43. package/generated/investigation/gather.md +45 -0
  44. package/generated/investigation/manifest.json +21 -0
  45. package/generated/investigation/synthesize.md +51 -0
  46. package/generated/operational-stabilization/assess.md +46 -0
  47. package/generated/operational-stabilization/execute-observe.md +45 -0
  48. package/generated/operational-stabilization/manifest.json +19 -0
  49. package/generated/operational-stabilization/monitor.md +45 -0
  50. package/generated/operational-stabilization/outcome.md +38 -0
  51. package/generated/operational-stabilization/respond.md +40 -0
  52. package/generated/operational-stabilization/verify-recovery.md +45 -0
  53. package/generated/product-change/ai-audit.md +12 -6
  54. package/generated/product-change/ai-review.md +20 -7
  55. package/generated/product-change/decision.md +16 -4
  56. package/generated/product-change/define.md +9 -4
  57. package/generated/product-change/deploy.md +9 -4
  58. package/generated/product-change/human-review.md +16 -4
  59. package/generated/product-change/implement.md +14 -5
  60. package/generated/product-change/manifest.json +9 -4
  61. package/generated/product-change/options.md +16 -4
  62. package/generated/product-change/outcome.md +9 -4
  63. package/generated/product-change/plan.md +22 -4
  64. package/generated/product-change/questions.md +22 -4
  65. package/generated/product-change/research.md +16 -4
  66. package/generated/product-change/verify.md +9 -4
  67. package/generated/recommended-skills.json +24 -0
  68. package/generated/reference/CONSTITUTION.md +43 -0
  69. package/generated/reference/docs/acceptable-ai-use.md +217 -0
  70. package/generated/reference/docs/design/adapted-skill-guidance.md +27 -0
  71. package/generated/reference/docs/design/debugging-and-operations.md +119 -0
  72. package/generated/reference/docs/design/executable-workflows.md +122 -0
  73. package/generated/reference/docs/design/instruction-authoring.md +28 -0
  74. package/generated/reference/docs/design/process-taxonomy.md +144 -0
  75. package/generated/reference/docs/design/review-workbench.md +37 -0
  76. package/generated/reference/docs/engineering-practice.md +163 -0
  77. package/generated/reference/docs/evidence/evidence-standard.md +123 -0
  78. package/generated/reference/docs/evidence/research-map.md +98 -0
  79. package/generated/reference/docs/rationale.md +210 -0
  80. package/generated/reference/docs/recommended-skills.md +19 -0
  81. package/generated/reference/docs/references/pragmatic-programmer-page-index.md +113 -0
  82. package/generated/reference/docs/references/submitted-engineering-notes.md +306 -0
  83. package/generated/reference/docs/releasing-pi.md +89 -0
  84. package/generated/reference/docs/workflows/README.md +142 -0
  85. package/generated/reference/docs/workflows/corrective-debugging.md +221 -0
  86. package/generated/reference/docs/workflows/decision.md +149 -0
  87. package/generated/reference/docs/workflows/internal-improvement.md +219 -0
  88. package/generated/reference/docs/workflows/investigation.md +161 -0
  89. package/generated/reference/docs/workflows/operational-stabilization.md +187 -0
  90. package/generated/reference/docs/workflows/product-change.md +216 -0
  91. package/generated/reference/index.json +298 -0
  92. package/package.json +36 -25
  93. package/src/engine.ts +26 -7
  94. package/src/flow-guides.ts +168 -0
  95. package/src/guidance.ts +220 -72
  96. package/src/index.ts +696 -140
  97. package/src/reference-viewer.ts +73 -0
  98. package/src/reference.ts +107 -0
  99. package/src/review.ts +360 -0
  100. package/src/skills.ts +133 -0
  101. package/src/storage.ts +77 -13
  102. package/src/types.ts +1 -0
@@ -0,0 +1,217 @@
1
+ # Acceptable AI Use in AHEAD
2
+
3
+ Status: binding pilot policy v0.1
4
+
5
+ ## Authority
6
+
7
+ This policy is binding for AHEAD pilot workflows. The [AHEAD Constitution](../CONSTITUTION.md) is the highest authority; this policy interprets its human-ownership boundaries; workflow profiles apply both and may narrow AI permissions for a phase. A workflow phase, diagram, tool permission, or local convenience cannot broaden AI authority beyond this policy. Organization and repository policies may impose stricter controls.
8
+
9
+ If two rules appear to conflict, apply the more protective rule and record the ambiguity for correction. No exception may transfer human authorship, judgment, approval, accountability, or unscoped consequential authority to AI.
10
+
11
+ ## Purpose
12
+
13
+ AHEAD encourages substantial AI assistance while preserving human understanding, judgment, skill, and accountability. Acceptable use is determined by the role AI plays, the risk of the work, the information exposed, and the engineer's ability to verify and own the result—not simply by how many lines AI produced.
14
+
15
+ The default relationship is:
16
+
17
+ ```text
18
+ Human supplies intent, context, and an initial model
19
+ → AI retrieves, generates, compares, or challenges
20
+ → Human verifies, decides, and owns the result
21
+ ```
22
+
23
+ ## Conditions for acceptable use
24
+
25
+ An AI-assisted contribution is acceptable only when all applicable conditions hold:
26
+
27
+ 1. A human owns the problem, intended behavior, and consequences.
28
+ 2. The AI's task is bounded and appropriate to the active workflow phase.
29
+ 3. The model receives only information authorized for that provider, tool, and purpose.
30
+ 4. Claims, citations, commands, dependencies, and generated artifacts can be checked against authoritative evidence.
31
+ 5. The responsible engineer can explain, maintain, debug, test, and modify accepted code.
32
+ 6. Verification is proportionate to risk and does not rely solely on the same AI that produced the work.
33
+ 7. Material AI involvement remains visible when repository, organizational, legal, or review policy requires it.
34
+ 8. The AI has no implicit authority to approve, merge, deploy, communicate commitments, accept risk, or act in production.
35
+
36
+ ## Generally acceptable uses
37
+
38
+ ### Research and information gathering
39
+
40
+ AI may locate, organize, compare, and summarize approved internal and external sources. The engineer follows important claims to their sources and distinguishes retrieved evidence from AI synthesis.
41
+
42
+ Why: AI increases search and synthesis capacity, while NIST identifies confident false content as an inherent generative-AI risk. Summaries are navigation aids, not new authorities.
43
+
44
+ ### Boilerplate and repetitive structure
45
+
46
+ AI may generate scaffolding, serializers, routine handlers, adapters, setup code, repetitive mappings, and other bounded structure after the human identifies the intended pattern and integration boundary.
47
+
48
+ The engineer checks local conventions, error handling, dependencies, security posture, and whether generation introduced unnecessary abstraction. “Boilerplate” is not a label that makes risky code safe.
49
+
50
+ ### Disposable prototypes and full vibe coding
51
+
52
+ Full “vibe coding”-prompting AI to produce most or all of an implementation without first understanding every detail-is acceptable for a disposable prototype whose purpose is to learn quickly whether an idea is feasible or how an experience might turn out.
53
+
54
+ This exception applies only when all of these boundaries are explicit:
55
+
56
+ - the learning question and prototype status are stated before generation;
57
+ - the prototype is isolated from production systems, credentials, customer data, and consequential decisions;
58
+ - nobody relies on its correctness, security, scalability, accessibility, or maintainability;
59
+ - generated dependencies, licenses, and external content remain subject to inspection;
60
+ - the prototype has an owner, an expiration or disposal decision, and a conspicuous `PROTOTYPE — NOT FOR PRODUCTION` label;
61
+ - demonstrations disclose material limitations rather than presenting simulated behavior as validated capability;
62
+ - any code selected for retention leaves the prototype exception and enters the normal AHEAD process for human understanding, design, implementation, testing, security review, and approval.
63
+
64
+ Throwaway describes the artifact, not the evidence learned from it. Preserve useful observations, constraints, failed approaches, and decisions as durable artifacts, then discard the code. A prototype must not become production software through incremental cleanup or repeated deployment.
65
+
66
+ This is an AHEAD operating policy supported by established prototyping practice, not evidence that unrestricted vibe coding produces production-quality systems.
67
+
68
+ ### Candidate tests
69
+
70
+ AI may propose test cases, fixtures, mocks, generators, boundary values, and failure scenarios after a human defines the expected behavior, important invariants, and test oracle.
71
+
72
+ Tests are reviewed as production code. The engineer checks that they can fail, do not merely encode the current implementation, cover meaningful states and failure paths, and do not silently weaken or replace existing tests. Security-critical tests require independent human authorship or review.
73
+
74
+ Research has found that LLM support can increase generated tests and defect detection, but also test volume and false positives. Test-guided interaction can improve people's ability to evaluate generated code. These findings support AI-assisted testing with human-defined intent and independent verification—not treating passing AI-generated tests as proof.
75
+
76
+ ### First-pass review
77
+
78
+ AI may perform an additional early review for likely defects, security concerns, missing tests, plan divergence, unclear code, and relevant edge cases.
79
+
80
+ AI review never constitutes final approval. Findings are hypotheses until a human validates them. Human review remains required because empirical work links substantive review participation and expertise with quality, while current LLM reviewers exhibit systematic false-positive and conformance-judgment failures.
81
+
82
+ For a lasting engineering change, independent human review means review by a person other than the implementer. The implementer and reviewer must both understand the behavior, risks, and evidence relevant to their responsibilities. Implementer self-review and AI review do not satisfy this gate. An emergency policy may defer independent review to restore service, but the gate remains unsatisfied until a named human reviewer completes it after stabilization.
83
+
84
+ ### Refactoring proposals
85
+
86
+ AI may identify duplication, coupling, unclear names, complicated control flow, possible abstractions, or opportunities to isolate state. The human decides whether the proposed change makes the artifact simpler and verifies preserved behavior.
87
+
88
+ AI may not manufacture a justification for a refactor or substitute rearranged files for reduced conceptual complexity.
89
+
90
+ ### Documentation and communication assistance
91
+
92
+ AI may organize engineer-provided facts, edit for clarity, create an outline, derive reference documentation from verified interfaces, and draft routine sections that the named author reviews.
93
+
94
+ The human supplies and verifies the reasoning, status, decisions, commitments, uncertainty, and audience judgment. AI must not fabricate citations, test results, incident facts, user claims, approvals, or confidence. It must not make weak understanding sound authoritative.
95
+
96
+ ### Debugging support
97
+
98
+ AI may help organize evidence, explain unfamiliar mechanisms, generate competing hypotheses, identify contradicting evidence, and propose discriminating tests.
99
+
100
+ Before broad AI assistance in normal debugging, the human records at least the observed failure, evidence already checked, and an initial mental model or question. A team may use a timebox before asking AI, but the purpose is independent thought—not withholding useful tools. During incidents, AI may assist immediately once the current observation and safety constraints are established.
101
+
102
+ The human remains the investigator: selecting or authorizing tests, interpreting results, deciding whether evidence supports a conclusion, and choosing the intervention.
103
+
104
+ ### Design alternatives
105
+
106
+ After the human frames the problem and contributes an initial option, AI may broaden the option set, compare tradeoffs, find examples, expose assumptions, and argue against the favored approach.
107
+
108
+ The human-first sequence is an AHEAD policy and design hypothesis, not a proven universal optimum. Adjacent experimental evidence shows that generative-AI ideas can improve individual creative output while reducing collective diversity, giving AHEAD a reason to test this sequence rather than claim it is settled.
109
+
110
+ ### Learning and onboarding
111
+
112
+ AI may explain code, concepts, patterns, libraries, tools, and unfamiliar terminology. Prefer explanations, questions, small examples, critiques, and hints that require the learner to retrieve and apply knowledge.
113
+
114
+ When skill formation is the goal, avoid full-solution delegation. A randomized study of developers learning an unfamiliar Python library found lower mastery for the AI-assisted group overall; participants who used AI to ask conceptual questions and build comprehension did better than those who delegated the work.
115
+
116
+ ### Examples, mocks, and planning mechanics
117
+
118
+ AI may generate non-sensitive sample payloads, mock data, fixtures, command examples, ticket structure, acceptance-criteria candidates, and summaries of human-provided notes.
119
+
120
+ Generated examples are checked for realism, privacy, security, and accidental use of production identifiers. AI may organize a human first-pass plan; it may not create the reasoning and relabel it as human-authored.
121
+
122
+ ## Uses requiring heightened review
123
+
124
+ AI may assist in these areas, but it does not originate the governing policy or act without explicit human control:
125
+
126
+ - authentication, authorization, cryptography, privacy, and security controls;
127
+ - business rules, financial calculations, safety constraints, and regulated behavior;
128
+ - database schemas, migrations, destructive maintenance, and data correction;
129
+ - concurrency, distributed consistency, recovery, and idempotency;
130
+ - dependencies, generated build steps, package scripts, and supply-chain changes;
131
+ - infrastructure, CI/CD, identity, permissions, and secrets;
132
+ - production commands, remediation, deployment, rollback, or containment;
133
+ - legal, compliance, personnel, customer, or public communication;
134
+ - generated licenses, attribution, or content with unclear provenance.
135
+
136
+ These uses require a named human owner, authoritative requirements, explicit scope, risk-appropriate tests, relevant specialist review, and separately authorized effects. Critical code and its only validation should not come from one AI context.
137
+
138
+ ## Unacceptable uses
139
+
140
+ ### Submitting work the engineer does not understand
141
+
142
+ Do not accept long-lived code that its responsible engineer cannot explain, maintain, debug, test, and safely change. Passing current tests is not sufficient.
143
+
144
+ ### Outsourcing core business logic
145
+
146
+ AI may explain, challenge, review, or help test core business rules. Under AHEAD, the accountable engineer authors their implementation and traces it to human-approved requirements. This is a constitutional policy choice whose precise boundary must be refined by teams.
147
+
148
+ ### Letting AI define behavior or policy
149
+
150
+ AI is not the authority for business rules, authorization, privacy, data retention, workflow behavior, acceptable risk, or production semantics. It may retrieve an authoritative rule; it may not become that authority.
151
+
152
+ ### Blind copying or unverified execution
153
+
154
+ Do not copy generated code, commands, dependencies, citations, or configuration without inspecting their meaning and validating them in the relevant environment. Never treat confident explanation as evidence.
155
+
156
+ ### Bypassing learning
157
+
158
+ Do not use AI to avoid acquiring skills needed to oversee the resulting system. When learning is the objective, the workflow should favor explanation, retrieval, prediction, and modification over full answer generation.
159
+
160
+ ### AI-first debugging with no human observation
161
+
162
+ Do not reduce debugging to pasting an error into a model and following its first answer. Establish what was observed and what evidence exists. AI-generated hypotheses are candidates, not diagnoses.
163
+
164
+ ### Outsourcing judgment or approval
165
+
166
+ AI may not select the team's technical opinion, accept tradeoffs, waive a gate, approve a change, declare an incident recovered, or perform final engineering review.
167
+
168
+ ### Impersonating human communication
169
+
170
+ AI may help edit or structure communication, but it may not invent reasoning and present it as the named person's own understanding. Humans own PR rationales, incident updates, decisions, commitments, and explanations sent under their identity.
171
+
172
+ ### Polishing over uncertainty
173
+
174
+ Do not use AI to make incomplete evidence appear conclusive, conceal disagreement, erase caveats, or make a person sound as though they understand work they have not examined.
175
+
176
+ ### Unauthorized data or access
177
+
178
+ Do not expose secrets, credentials, personal data, confidential source, customer information, incident evidence, regulated data, or proprietary material to an unapproved model or provider. Do not assume `.gitignore` prevents an editor assistant from reading a file.
179
+
180
+ Do not give an AI agent broader filesystem, network, repository, CI, cloud, or production permissions than its bounded task requires. Repository text, issues, logs, web pages, and tool output are untrusted inputs that may attempt to redirect the agent.
181
+
182
+ ## Verification checklist
183
+
184
+ Before accepting material AI-assisted work, the responsible engineer answers:
185
+
186
+ - What did the human decide before AI involvement?
187
+ - What did the AI contribute?
188
+ - Can I explain the result without appealing to the AI's authority?
189
+ - Which facts, requirements, and sources did I independently verify?
190
+ - What tests could disprove the implementation or conclusion?
191
+ - Did the same AI create both the work and all evidence used to validate it?
192
+ - What sensitive context was shared, with which provider, under what policy?
193
+ - Did the AI introduce dependencies, licenses, commands, or external content?
194
+ - What could fail outside the examples the AI saw?
195
+ - Am I willing and authorized to own this result?
196
+
197
+ For a disposable prototype, also answer:
198
+
199
+ - What specific question is this prototype meant to answer?
200
+ - Where is it isolated, and what production access or sensitive data is excluded?
201
+ - When will it be discarded or deliberately re-enter the normal engineering workflow?
202
+
203
+ ## Evidence and sources
204
+
205
+ - [Cui et al., *The Effects of Generative AI on High-Skilled Work*](https://doi.org/10.1287/mnsc.2025.00535) — randomized field evidence that coding assistants can increase completed tasks in some organizational contexts.
206
+ - [Becker et al., *Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity*](https://arxiv.org/abs/2507.09089) — randomized evidence that the same broad category of tool can slow experienced developers in familiar repositories, despite perceived speedups.
207
+ - [Shen and Tamkin, *How AI Impacts Skill Formation*](https://arxiv.org/abs/2601.20245) — randomized study of AI assistance, code understanding, and learning an unfamiliar library.
208
+ - [Ramler et al., *Unit Testing Past vs. Present*](https://arxiv.org/abs/2502.09801) — experiment on LLM-supported unit testing, defect detection, and false positives.
209
+ - [Fakhoury et al., *LLM-Based Test-Driven Interactive Code Generation*](https://www.microsoft.com/en-us/research/publication/llm-based-test-driven-interactive-code-generation-user-study-and-empirical-evaluation/) — user study and evaluation of test-guided intent clarification.
210
+ - [Jin and Chen, *Are LLMs Reliable Code Reviewers?*](https://arxiv.org/abs/2603.00539) — evidence of systematic overcorrection in LLM requirement-conformance review.
211
+ - [Doshi and Hauser, *Generative AI enhances individual creativity but reduces the collective diversity of novel content*](https://doi.org/10.1126/sciadv.adn5290) — adjacent experimental evidence relevant to AI anchoring and option diversity.
212
+ - [Bjarnason, Lang, and Mjöberg, *An empirically based model of software prototyping*](https://doi.org/10.1007/s10664-023-10331-w) — a systematic mapping study and multi-company study of prototypes used to explore and validate feasibility, desirability, usability, and requirements.
213
+ - [NIST AI 600-1, *Generative Artificial Intelligence Profile*](https://doi.org/10.6028/NIST.AI.600-1) — authoritative risk guidance on confabulation, privacy, provenance, testing, and governance.
214
+ - [NIST DevSecOps reference model: Artificial Intelligence](https://pages.nist.gov/nccoe-devsecops/notational-reference-model.html#artificial-intelligence) — human validation and verifiable-process guidance for AI-augmented software development.
215
+ - [OWASP Secure Coding with AI Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Secure_Coding_with_AI_Cheat_Sheet.html) — practitioner security guidance for sensitive context, agent permissions, generated tests, supply chains, and CI/CD.
216
+
217
+ The [research map](evidence/research-map.md) classifies these sources and records their limitations. Exact boundaries such as “core business logic” and the human-first debugging checkpoint remain AHEAD policy choices that should be tested and refined.
@@ -0,0 +1,27 @@
1
+ # Adapted Skill Guidance
2
+
3
+ Status: approved first adaptation set, 2026-08-12
4
+
5
+ AHEAD reviewed the [Matt Pocock skills collection](https://www.skills.sh/mattpocock/skills), including the specifically discussed [grill-me](https://www.skills.sh/mattpocock/skills/grill-me), [prototype](https://www.skills.sh/mattpocock/skills/prototype), and [ask-matt](https://www.skills.sh/mattpocock/skills/ask-matt) skills. It also reviewed [Ponytail](https://github.com/DietrichGebert/ponytail/tree/2ed6c52c9d7e5e56942508591085fd45dea277d3/skills/ponytail). The useful ideas were treated as design input, not installed wholesale or made authoritative.
6
+
7
+ ## Adapted into AHEAD now
8
+
9
+ - Guided questioning became a dependency-frontier method: AI discovers facts, humans answer consequential judgment questions, and rounds scale with risk.
10
+ - Research became provenance inside existing workflow artifacts: primary sources, direct observations, contradictions, applicability, and uncertainty.
11
+ - Planning became human-first vertical decomposition with dependencies, acceptance criteria, rollout, recovery, and expand-migrate-verify-contract stages for broad changes.
12
+ - Debugging gained tighter safe feedback loops, minimized reproductions, ranked falsifiable hypotheses, one-variable probes, tagged instrumentation, regression evidence, and an explicit no-safe-reproduction path.
13
+ - Prototyping became an Investigation technique with an explicit learning question, deliberately disposable code, visible outcomes, and mandatory human disposition. Prototype code cannot be promoted directly.
14
+ - Review became an exact-changeset workbench with structured AI findings, a separate implementing-human disposition, and later independent human judgment.
15
+ - Instruction design became progressive disclosure: binding profile, applicable phase and method fragments, then on-demand framework references.
16
+
17
+ These adaptations live in AHEAD's own workflow specs, `policy/methods`, and host-neutral contracts. They require only artifacts already justified by an AHEAD phase; no source skill's private artifact system or issue format was imported.
18
+
19
+ ## Deliberately not adopted
20
+
21
+ - Persona emulation such as “ask Matt” is not framework authority or a substitute for project evidence.
22
+ - No skill may skip the human's initial model, decision, plan, understanding, tests, or review.
23
+ - A quick, lazy, or persistent implementation is not production-ready merely because it runs.
24
+ - AHEAD does not silently install third-party skills, create extra artifacts, post GitHub comments, create issues, push code, or mark a pull request ready.
25
+ - Issue intake, domain or architecture specialization, formal understanding handoff, and wayfinding remain deferred until their AHEAD-native process is separately approved.
26
+
27
+ The recommendation catalog records external code AHEAD suggests installing. The method overlays record guidance AHEAD owns. Keeping those separate allows a project to use any editor or model without depending on a particular skill package.
@@ -0,0 +1,119 @@
1
+ # Debugging and Operational Investigation
2
+
3
+ Status: design discussion, not an approved workflow specification
4
+
5
+ The minimal [corrective-debugging](../workflows/corrective-debugging.md) and [operational-stabilization](../workflows/operational-stabilization.md) profiles translate this discussion into pilotable flows. This document retains the reasoning and unresolved questions behind them.
6
+
7
+ ## Human ownership
8
+
9
+ Debugging is human-owned. AI may help collect and organize evidence, suggest hypotheses and tests, identify contradictions, explain systems, and challenge conclusions. The human chooses what to investigate, performs or authorizes tests, interprets the evidence, selects interventions, and accepts the conclusion or remaining uncertainty.
10
+
11
+ There is no “AI investigation” phase. Investigation is a human engineering activity in which AI may participate.
12
+
13
+ ## Shared reasoning loop
14
+
15
+ ```text
16
+ Observation
17
+ → Characterize
18
+ → Build or update the mental model
19
+ → Generate hypotheses
20
+ → Human selects a discriminating test
21
+ → Predict expected results
22
+ → Run the test
23
+ → Record evidence
24
+ → Update or refute hypotheses
25
+ → Repeat
26
+ ```
27
+
28
+ The process distinguishes:
29
+
30
+ - **Fact:** directly observed and linked to evidence.
31
+ - **Inference:** an interpretation derived from facts.
32
+ - **Hypothesis:** a falsifiable proposed explanation.
33
+ - **Test:** an experiment or observation capable of changing confidence in a hypothesis.
34
+ - **Result:** what the test actually produced.
35
+ - **Conclusion:** a human-accepted explanation with confidence, limits, and remaining uncertainty.
36
+
37
+ Predictions should be recorded before a test when practical. This reduces hindsight interpretation of ambiguous results.
38
+
39
+ ## Bug debugging
40
+
41
+ A bug is a defect where observed software behavior conflicts with intended behavior.
42
+
43
+ ```text
44
+ Observe → Reproduce or establish
45
+ → Characterize
46
+ → Human-led investigation loop
47
+ → Human accepts diagnosis or uncertainty
48
+ → Choose fix → Plan → Implement → Validate locally
49
+ → AI review → Independent human review
50
+ → Human-authorized deploy or release when applicable
51
+ → Verify the original failure and observe the outcome
52
+ → Audit assumptions → Human outcome
53
+ ```
54
+
55
+ Reproduction is valuable but not universally required. A failure may be intermittent, historical, production-only, environment-specific, or already mitigated.
56
+
57
+ ## Operational investigation
58
+
59
+ An operational issue is undesirable system behavior that may not be a software defect. Examples include reconciliation storms, configuration drift, capacity exhaustion, cloud-provider behavior, dependency failures, identity or certificate failures, resource contention, bad rollout sequencing, and emergent controller interactions.
60
+
61
+ ```text
62
+ Observed condition
63
+ → Desired state versus actual state
64
+ → Impact and scope
65
+ → Timeline
66
+ → System and control-loop model
67
+ → Recent changes and external events
68
+ → Evidence/hypothesis/test loop
69
+ → Intervention decision
70
+ → Verify convergence and user-visible behavior
71
+ → Monitor recurrence
72
+ → Corrective actions
73
+ ```
74
+
75
+ The initial cause classification must remain tentative. Labeling an issue a code bug, configuration error, or provider failure before collecting evidence can bias the investigation.
76
+
77
+ ## Incident mode
78
+
79
+ “Incident” describes impact and urgency rather than cause. An incident may be caused by a bug, configuration, capacity, provider behavior, a security event, data, or an interaction that remains partially unexplained.
80
+
81
+ Incident mode adds parallel concerns:
82
+
83
+ ```text
84
+ Response: assess impact → contain → recover → monitor
85
+ Investigation: evidence → model → hypotheses → tests → conclusion
86
+ Coordination: ownership → decisions → communications → timeline
87
+ ```
88
+
89
+ Mitigation and recovery must not be blocked on completing a full diagnosis. Risky interventions still require explicit human authorization. After recovery, unresolved causal analysis and prevention work may continue as a linked bug, operational investigation, security issue, or technical-debt item.
90
+
91
+ ## Current design direction
92
+
93
+ - Treat bug debugging and operational investigation as separate work types.
94
+ - Treat incident mode as an overlay that may apply to several work types.
95
+ - Keep the evidence and hypothesis loop flexible rather than gating every iteration.
96
+ - Reserve hard gates for human accountability, risky tests, consequential interventions, accepted conclusions, implementation plans, reviews, and verified outcomes.
97
+ - Distinguish hypothesis testing, fix validation, and post-deployment outcome verification.
98
+ - Allow causal conclusions to include a failure mechanism, trigger, enabling conditions, and detection or containment gaps instead of insisting on one root cause.
99
+
100
+ ## Open questions
101
+
102
+ - What minimum evidence is needed before a human may accept a diagnosis?
103
+ - When may a team remediate while explicitly accepting that the cause is unknown?
104
+ - Which tests require approval based on environment, reversibility, or blast radius?
105
+ - How should AHEAD represent multiple interacting causes and confidence changes?
106
+ - When does an operational anomaly become incident mode?
107
+ - Which incident records must be produced during response, and which may be reconstructed afterward?
108
+ - How should follow-up work remain linked without keeping the incident itself permanently open?
109
+
110
+ ## Evidence basis
111
+
112
+ The current reasoning loop is supported by direct empirical software-engineering research, though the exact AHEAD recording requirements are not yet validated:
113
+
114
+ - [Li and Coblenz, *A Grounded Theory of Debugging in Professional Software Engineering Practice*](https://arxiv.org/abs/2602.11435) observed professional developers and describes debugging as iterative mental-model construction that guides information gathering.
115
+ - [Alaboudi and LaToza, *Using Hypotheses as a Debugging Aid*](https://doi.org/10.1109/VL/HCC50065.2020.9127273) found that early correct hypotheses predicted success and that supplying potential hypotheses helped more than supplying fault locations in their controlled experiment.
116
+ - [Sillito and Kutomi, *Failures and Fixes*](https://doi.org/10.1109/ICSME46990.2020.00027) analyzed 30 incidents and identified distinct investigative and mitigative strategies.
117
+ - [Ghosh et al., *How to Fight Production Incidents?*](https://doi.org/10.1145/3542929.3563482) studied hundreds of high-severity cloud incidents, including non-code causes, across detection, diagnosis, and mitigation.
118
+
119
+ These studies support the shape of the process. They do not prove that requiring engineers to record every fact, hypothesis, or test improves results. AHEAD must test the minimum useful structure and remove requirements that interrupt investigation without improving reasoning, handoff, or learning.
@@ -0,0 +1,122 @@
1
+ # Executable AHEAD Workflows
2
+
3
+ Status: six-flow executable dogfood v0.1
4
+
5
+ ## Purpose
6
+
7
+ The executable layer makes AHEAD workflow state durable and makes selected human/AI boundaries enforceable across integrations. It does not turn judgment into a checklist or make workflow artifacts proof of understanding.
8
+
9
+ The executable layer implements all six pilot workflows. They share a versioned event model and enforcement engine while retaining workflow-specific phases, artifacts, gates, returns, AI capabilities, and generated instructions.
10
+
11
+ ## Architecture
12
+
13
+ ```text
14
+ CONSTITUTION / ACCEPTABLE-AI-USE
15
+
16
+
17
+ CANONICAL WORKFLOW SPEC + POLICY FRAGMENTS
18
+
19
+ ┌────────┴────────┐
20
+ ▼ ▼
21
+ RUST WORKFLOW CORE GENERATED INSTRUCTIONS
22
+ │ │
23
+ └────────┬────────┘
24
+
25
+ INTEGRATION ADAPTER
26
+ (Pi first; others later)
27
+
28
+ ┌────────┴─────────┐
29
+ ▼ ▼
30
+ HOST TOOLS / MODEL DURABLE RUN FILES
31
+ ```
32
+
33
+ The Rust core owns workflow semantics. It is deterministic and has no filesystem, network, clock, model-provider, or editor dependency. Hosts supply identity and timestamps, persist returned runs, and map their tools to canonical capabilities.
34
+
35
+ The initial WebAssembly boundary is a small versioned JSON ABI. This avoids coupling the core to one JavaScript binding generator and lets a later editor or CI integration load the same state machine.
36
+
37
+ ## Sources of truth
38
+
39
+ | Concern | Canonical source |
40
+ |---|---|
41
+ | Durable principles | `CONSTITUTION.md` |
42
+ | AI authority | `docs/acceptable-ai-use.md` |
43
+ | Human-readable flows | `docs/workflows/*.md` |
44
+ | Current executable phases, artifacts, gates, transitions, and capabilities | `spec/workflows/*.json` |
45
+ | Published historical workflow definitions retained for replay | `spec/workflows/legacy/*.json` |
46
+ | Compact binding agent profile and shared AI behavior | `policy/common.md` |
47
+ | Phase AI behavior | `policy/<workflow>/*.md` with shared engineering-tail fragments in `policy/shared/*.md` |
48
+ | Reusable phase practices | `policy/methods/*.md`, selected by `policy/methods/index.json` |
49
+ | Reviewed optional skills | `recommendations/skills-v0.1.json` |
50
+ | State transition enforcement | `crates/ahead-core` |
51
+ | Host mapping, storage, and UI | `integrations/pi` |
52
+
53
+ Generated integration instructions are build artifacts. They include the compact agent profile, active phase policy, enforced contract, workflow version, and a source hash and must not be edited directly.
54
+
55
+ The engine retains published historical workflow definitions for replay while new runs use the current definition. Product Change `0.1.0` remains embedded for existing runs; the review and audit disposition contract is Product Change `0.2.0`. A run is always replayed against the version recorded when it started rather than silently reinterpreted under the newest workflow.
56
+
57
+ The Pi package also copies the canonical Constitution and `docs/**/*.md` into a generated reference catalog. These full documents are not injected into every prompt. The adapter recommends references applicable to the active phase, lets humans read them through `/ahead-guide`, and lets AI retrieve a specific source through `ahead_get_reference`. This keeps the binding prompt small while making the framework, rationale, evidence, and original page-level provenance available on demand.
58
+
59
+ ## State and evidence
60
+
61
+ A run is an append-only event log. Events record an actor kind and identity, host-supplied timestamp, sequence, and one action:
62
+
63
+ - start the run;
64
+ - record an artifact;
65
+ - accept a human gate;
66
+ - advance or return between phases;
67
+ - close the run.
68
+
69
+ State is derived by replay. The core rejects invalid history rather than trusting a cached phase field. A return transition creates a new visit to the target phase. Earlier evidence remains in history, but only evidence recorded during the current visit satisfies its gate.
70
+
71
+ Pi stores state under the work's Git root:
72
+
73
+ ```text
74
+ .ahead/
75
+ ├── current.json
76
+ └── runs/
77
+ └── <run-id>/
78
+ ├── run.json
79
+ └── artifacts/
80
+ └── <sequence>-<phase>-<kind>.md
81
+ ```
82
+
83
+ These are intended to be inspectable, diffable repository artifacts. A team can decide which records belong in Git, while CI and GitHub enforcement are later adapters over the same run contract.
84
+
85
+ ## Enforced boundaries in v0.1
86
+
87
+ - Only a human actor can start a run, accept a gate, transition a phase, return work, or close a run.
88
+ - Artifact definitions state whether a human, AI, or either may record them.
89
+ - Workflow-specific human-first artifacts unlock AI assistance only after the human's initial model, option, plan, baseline, or other required reasoning exists.
90
+ - Required current-visit artifacts must exist before gate acceptance.
91
+ - Advancement requires the current human gate.
92
+ - Independent human review must be recorded by an identity other than the latest changeset implementer, and that reviewer must accept the review gate.
93
+ - Lasting-change flows distinguish implementation, AI review, independent human review, deployment, observation, audit, and human outcome.
94
+ - AI review is bound to a fingerprint of the exact current engineering changeset. The implementing human records a separate disposition for every material AI finding before independent human review.
95
+ - AI-audit findings and their human disposition are separate required records, and the human disposer personally accepts the audit gate.
96
+ - Operational Stabilization permits investigation and recovery work to proceed without proven root cause, but never grants AI the `execute` capability for the intervention or its execution phase.
97
+ - Decision and Investigation close with human-owned records and do not silently authorize downstream implementation.
98
+ - Model-invoked host tools require an explicit adapter mapping to an allowed canonical capability.
99
+
100
+ Instructions explain these boundaries to the model. The Rust core enforces the transition, actor, artifact, identity, and capability decisions even if instructions are ignored.
101
+
102
+ During implementation, instructions explicitly permit questions, explanation, debugging help, and bounded suggestions while keeping the engineer first. If the engineer has not supplied a current model, attempted approach, or intended behavior, AI asks for it before proposing a solution. A request for help does not authorize AI to take over the implementation.
103
+
104
+ ## Trust boundaries and limits
105
+
106
+ The Pi adapter is an engineering workflow control, not a security sandbox.
107
+
108
+ - Local human identity comes from `AHEAD_HUMAN_IDENTITY`, then Git email/name, then the local user. It is self-attested. GitHub review identity and protected-branch rules will provide a stronger boundary later.
109
+ - Pi's direct `!` shell is a human action and is not intercepted. Model-invoked `bash` is intercepted.
110
+ - Unknown model tools are denied until the adapter classifies them. This prevents a newly installed effectful tool from silently acquiring authority.
111
+ - Artifact and run writes are atomic, but v0.1 has no multi-process lock. One writer should operate a run at a time.
112
+ - Workflow files can prove that a named action was recorded, not that a person genuinely understood it. Human review and organizational accountability remain necessary.
113
+ - No GitHub checks, PR gates, migration engine, signature scheme, or backwards-compatible workflow upgrade exists yet.
114
+ - Local review fingerprints detect changes but are not signatures. A future GitHub adapter must add remote identity and protected-branch evidence rather than treating the local record as cryptographic proof.
115
+
116
+ ## Reuse path
117
+
118
+ The reusable boundary is the engine API, not a CLI. Pi is the first adapter. A VS Code extension, GitHub check, or future WASM-capable editor can reuse the same compiled core and canonical fragments while providing its own UI, storage transport, identity strength, and tool-capability map.
119
+
120
+ Review presentation follows the same rule. The core requires snapshot-bound findings, dispositions, and review gates; a host maps portable paths and locations to a terminal viewer, VS Code diff/comment UI, or GitHub review API. See `docs/design/review-workbench.md`.
121
+
122
+ Dogfooding should test whether the six encoded flows route real work correctly, whether their records and gates earn their cost, and whether phase visits, returns, capability vocabulary, and identity rules generalize across integrations.
@@ -0,0 +1,28 @@
1
+ # Instruction Authoring
2
+
3
+ Status: initial authoring standard v0.1
4
+
5
+ AHEAD instructions are an executable interface to the framework. They should make the next valid behavior clear without duplicating the full Constitution, rationale, or workflow documentation into every model turn.
6
+
7
+ ## Progressive disclosure
8
+
9
+ Use three layers:
10
+
11
+ 1. The active profile supplies the binding human/AI authority boundary and live workflow state.
12
+ 2. The generator adds the workflow phase fragment and only the method overlays mapped to that phase in `policy/methods/index.json`.
13
+ 3. Humans and AI retrieve full framework Markdown on demand through the host integration.
14
+
15
+ The canonical workflow spec owns phases, artifacts, gates, transitions, and capabilities. Phase policies own local AI behavior. Method overlays own reusable practices such as evidence handling or debugging. Full documents explain why. Do not restate one rule in every layer.
16
+
17
+ ## Authoring rules
18
+
19
+ - State the desired observable behavior in direct, positive language.
20
+ - Put human ownership and prohibited transfers of authority where a model cannot mistake them for suggestions.
21
+ - Give checkable completion criteria: an exact artifact, observation, identifier, or gate condition.
22
+ - Point to the canonical source instead of copying large passages.
23
+ - Keep host-specific UI out of core workflow semantics.
24
+ - Do not cache repository facts that tools can discover cheaply and reliably.
25
+ - Use examples to clarify a schema, not to narrow judgment to the example.
26
+ - Treat generated instructions as build artifacts and test the generated output for required boundaries.
27
+
28
+ The build fails when a method overlay names an unknown workflow or phase. Adding a method therefore requires its source fragment, an explicit mapping, generated-output coverage, and documentation when it changes user-visible expectations.