harness-everything 0.11.6 → 0.11.7

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 (49) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +13 -0
  4. package/README.md +7 -3
  5. package/ci/mechanism-2a-rule-of-3.test.js +71 -0
  6. package/ci/mechanism-2ah-workflow-lifecycle.test.js +139 -0
  7. package/ci/mechanism-2c-state-persist.test.js +45 -2
  8. package/ci/mechanism-2t-issue-20.test.js +0 -8
  9. package/ci/mechanism-30-opencode-plugin-loadability.test.js +39 -7
  10. package/docs/architecture.md +17 -0
  11. package/docs/audit.md +52 -5
  12. package/docs/release-evidence.md +3 -0
  13. package/docs/workflow-runtime.md +13 -0
  14. package/docs/workflows/environment-detection.md +47 -37
  15. package/docs/workflows/eval-harness.md +45 -38
  16. package/docs/workflows/fable-discipline.md +45 -33
  17. package/docs/workflows/git-commit.md +53 -45
  18. package/docs/workflows/grill-me.md +36 -38
  19. package/docs/workflows/grill-with-docs.md +36 -46
  20. package/docs/workflows/harness-everything.md +59 -57
  21. package/docs/workflows/improve-codebase-architecture.md +36 -44
  22. package/docs/workflows/install-cognitive-os.md +36 -29
  23. package/docs/workflows/repo-docs.md +29 -40
  24. package/docs/workflows/rewrite-commits.md +40 -36
  25. package/docs/workflows/security-review.md +34 -53
  26. package/docs/workflows/skill-creator.md +39 -56
  27. package/docs/workflows/skill-style.md +35 -40
  28. package/docs/workflows/using-git-worktrees.md +40 -44
  29. package/docs/workflows/verification-loop.md +43 -48
  30. package/docs/workflows/verify-before-claim.md +37 -40
  31. package/docs/workflows/zoom-out.md +39 -51
  32. package/harness-everything/SKILL.md +1 -1
  33. package/harness-everything/scripts/kernel-router.js +38 -10
  34. package/hooks/scripts/lib/workflow-isolation.js +30 -1
  35. package/hooks/scripts/rule-of-3-tracker.js +17 -9
  36. package/hooks/scripts/state-persist.js +14 -6
  37. package/hooks/scripts/workflow-gate.js +5 -1
  38. package/opencode-plugin/plugin.json +1 -1
  39. package/package.json +1 -1
  40. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  41. package/plugins/harness-everything/hooks/scripts/lib/workflow-isolation.js +30 -1
  42. package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +17 -9
  43. package/plugins/harness-everything/hooks/scripts/state-persist.js +14 -6
  44. package/plugins/harness-everything/hooks/scripts/workflow-gate.js +5 -1
  45. package/plugins/harness-everything/plugin.json +1 -1
  46. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  47. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +38 -10
  48. package/docs/issue-20-rollup.md +0 -47
  49. package/docs/reviews/pr-142-issue-131.md +0 -89
@@ -1,69 +1,59 @@
1
- # Workflow: Grill with Docs
1
+ # Workflow: Grill With Docs
2
2
 
3
- > Decision tracking, Glossary alignment, and ADR-driven (Architecture Decision Record) grilling to eliminate technical drift between code and documentation.
3
+ > Tests a plan against the recorded domain language and past decisions, tightens fuzzy terminology into canonical terms, and writes CONTEXT.md and ADR updates inline as choices settle.
4
4
 
5
- ---
5
+ Source of truth: `grill-with-docs/SKILL.md`.
6
6
 
7
7
  ## 1. Skill Behavior Workflow
8
8
 
9
- This section visualizes how the `grill-with-docs` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
9
  ```mermaid
12
10
  graph TD
13
- Start([Plan Proposed against Domain]) --> CheckCoreValidity{Plan vague or unverified?}
14
- CheckCoreValidity -->|Yes| RecommendGrillMe["Recommend running grill-me first"]
15
- CheckCoreValidity -->|No| ReadDomainModel["Read CONTEXT.md and existing ADRs"]
16
- RecommendGrillMe --> EndVague([Postponed until plan is hardened])
17
- ReadDomainModel --> ChallengeDrift["Examine plan for term drift or architectural violations"]
18
- ChallengeDrift --> UpdateGlossary["Refine and match terminology with current Glossary"]
19
- UpdateGlossary --> ResolveADRPath{Resolve ADR Storage Path}
20
-
21
- ResolveADRPath -->|docs/adr/ or CONTEXT-MAP.md Exists| WriteDocs["Write ADR to docs/adr/ or CONTEXT-MAP.md Location"]
22
- ResolveADRPath -->|No Folder Found| WriteFallback["Write to committable docs/adr"]
23
-
24
- WriteDocs --> ToSpec["Hand off to to-spec for Outline Preview & Spec/ADR Publishing"]
25
- WriteFallback --> ToSpec
26
- ToSpec --> End([Route to to-tickets / fable-mode / tdd])
11
+ PlanInput["Plan needing domain alignment"] --> ResolveStorage["Resolve storage with project-docs-resolver.js; CONTEXT-MAP.md root wins"]
12
+ ResolveStorage --> ChallengeTerms["Challenge glossary conflicts; sharpen fuzzy terms to canonical ones"]
13
+ ChallengeTerms --> ScenarioTest["Stress-test relationships with concrete scenarios; cross-check claims against code"]
14
+ ScenarioTest --> InlineUpdate["Update context glossary inline, never batched; zero implementation details"]
15
+ InlineUpdate --> ADRGate{"ADR warranted: hard to reverse plus surprising without context plus real trade-off?"}
16
+ ADRGate -->|Yes| WriteADR["Offer and write ADR at resolved location"]
17
+ ADRGate -->|No| SkipADR["Skip ADR; keep pure glossary"]
18
+ WriteADR --> Handoff["Hand off aligned design to to-spec"]
19
+ SkipADR --> Handoff
27
20
  ```
28
21
 
29
- ---
30
-
31
22
  ## 2. Triggering and Routing Path
32
23
 
33
- This diagram illustrates how the `grill-with-docs` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
34
-
35
24
  ```mermaid
36
25
  graph LR
37
- Router["harness-everything / tier-router.js"] -->|Keyword: adr / decision / glossary| GWD["grill-with-docs / SKILL.md"]
38
- GrillMe["grill-me / SKILL.md"] -->|Hardened plan ready for formalization| GWD
39
- GWD -->|Aligns documentation during macro work in| Fable["fable-mode / SKILL.md"]
40
- GWD -->|Triggers todo tasks tracked by| Todo["todo-driven-workflow / SKILL.md"]
41
- GWD -->|Hands off to generate specifications| ToSpec["to-spec / SKILL.md"]
26
+ DomainStress["Input: stress-testing a plan against domain language and documented decisions"] --> GWD["grill-with-docs / SKILL.md"]
27
+ GWD --> GrillMe["grill-me for unverified design"]
28
+ GWD --> ToSpec["to-spec for aligned design"]
29
+ ToSpec --> ToTickets["to-tickets for execution"]
30
+ ToSpec --> FableMode["fable-mode for execution"]
31
+ ToSpec --> TDD["tdd for execution"]
42
32
  ```
43
33
 
44
- ---
45
-
46
- ## 3. Real-World Use Case Flowchart
47
-
48
- Here we model concrete real-world scenarios and use cases of the `grill-with-docs` skill, illustrating standard success paths, error handling, or recovery loops.
34
+ ## 3. Real-World Use Case
49
35
 
50
36
  ```mermaid
51
37
  graph TD
52
- Start["Requirement: Change notification retry rate limits"] --> Trigger["grill-with-docs skill invoked"]
53
- Trigger --> ReadDocs["Analyzes docs/adr/003-rate-limiting.md"]
54
- ReadDocs --> CheckDrift["Finds that proposed change violates the maximum overload protection limit"]
55
- CheckDrift --> RefinePlan["Plan updated to stay within the 003-rate-limiting contract"]
56
- RefinePlan --> CreateADR["Create docs/adr/008-notification-retries.md"]
57
- CreateADR --> SyncCode["Modify code and inject aligned TODO tags directly in code to maintain truth"]
58
- SyncCode --> Done([Zero architectural drift achieved])
38
+ RetryProposal["Proposal: change notification retry limits"] --> ResolveDocs["Resolve docs location; read CONTEXT.md and rate-limit ADR"]
39
+ ResolveDocs --> Conflict["Find glossary conflict: retry versus backoff"]
40
+ Conflict --> Scenario["Scenario test: burst retry against overload protection limit"]
41
+ Scenario --> GlossaryFix["Inline glossary fix to canonical terms"]
42
+ GlossaryFix --> ADRDecision["ADR offered because limit change is hard to reverse and involves trade-off"]
43
+ ADRDecision --> AlignedHandoff["Aligned design to to-spec; execution to to-tickets, fable-mode, or tdd"]
59
44
  ```
60
45
 
61
- ---
46
+ Concrete example: a retry-limit change is checked against the existing rate-limiting ADR and code. Fuzzy retry language is sharpened, the glossary is fixed inline, and only because the decision is hard to reverse and surprising without context is an ADR written. An unverified design would go to `grill-me` first instead.
62
47
 
63
- ## 4. Verification Check
48
+ Deep detail: `grill-with-docs/references/session-playbook.md`. Formats: `grill-with-docs/ADR-FORMAT.md`, `grill-with-docs/CONTEXT-FORMAT.md`.
64
49
 
65
- To ensure that the `grill-with-docs` skill is operating in strict compliance with Harness OS design laws, verify the following:
50
+ ## 4. Verification Check
66
51
 
67
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
68
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
69
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
52
+ - [ ] Storage resolved with `multi-agent-workspace/scripts/project-docs-resolver.js`; `<workspace>/CONTEXT-MAP.md` root wins
53
+ - [ ] Fuzzy terms sharpened to canonical ones; glossary stays pure with zero implementation details
54
+ - [ ] Relationships tested with concrete scenarios and claims cross-checked against code
55
+ - [ ] Context glossary updated inline, never batched
56
+ - [ ] ADR offered only when hard to reverse plus surprising without context plus a real trade-off
57
+ - [ ] ADRs meet the 3-part bar; handoff to `to-spec` after alignment
58
+ - [ ] Routing respected: unverified design to `grill-me`; aligned design to `to-spec`; execution to `to-tickets`, `fable-mode`, or `tdd`
59
+ - [ ] Not used for verifying unstable designs without a grilling pass, and not used for spec publishing without grilling
@@ -1,95 +1,97 @@
1
1
  # Workflow: Harness Everything
2
2
 
3
- > The single entry point and dynamic router of Harness OS, triaging tasks into appropriate tiers and auto-loading synergistic knowledge guides.
3
+ > Route software/project work through the Harness kernel: classify Tier 1/2/3, establish mandatory invariants, then let the agent choose tactics and domain skills. Not general Q&A or non-software writing.
4
+
5
+ Source of truth: `harness-everything/SKILL.md`. Deep dive: `harness-everything/references/triage-and-tiers.md`.
4
6
 
5
7
  ---
6
8
 
7
9
  ## 1. Skill Behavior Workflow
8
10
 
9
- This section visualizes how the `harness-everything` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
11
+ The kernel establishes the smallest applicable workflow before mutation. Suggested skills are mandatory to evaluate and advisory to execute; the selected topology is mandatory to resolve.
10
12
 
11
13
  ```mermaid
12
14
  graph TD
13
15
  Start([User Prompt Received]) --> CheckSoftware{Software / Engineering Task?}
14
- CheckSoftware -->|No: Pure Chat / Translation / Web Search| BypassHarness["Bypass Harness OS Completely - Reply Directly"]
15
- CheckSoftware -->|Yes: Code / Architecture / Project| ExecuteRouter["Execute tier-router.js OR check UserPromptSubmit hook output"]
16
- ExecuteRouter --> DetectNewFeature{Contains new logic/files?}
17
- DetectNewFeature -->|Yes, enforce Tier 2+| PreventDegrade["Prevent Silent Degrade to Tier 1"]
18
- PreventDegrade --> TriageTier
19
- DetectNewFeature -->|No| TriageTier{Triage Tier}
20
-
21
- TriageTier -->|Tier 1: Trivial| Tier1Route["Tier 1: Direct Edit No Checklist"]
22
- TriageTier -->|Tier 2: Standard| Tier2Route["Tier 2: TDD & Todo-driven work"]
23
- TriageTier -->|Tier 3: Macro| Tier3Route["Tier 3: Fable Planning & Agent Scaffolding"]
24
-
25
- Tier1Route --> LoadGuides["Auto-load & output Synergistic Guides"]
26
- Tier2Route --> LoadGuides
27
- Tier3Route --> LoadGuides
28
-
29
- LoadGuides --> FactCheck{External Claims / Estimates?}
30
- FactCheck -->|Yes| FactReminder["Append Fact-Audit Reminder"]
31
- FactCheck -->|No| FinalizeOutput["Finalize Routing Checkpoint Output"]
32
- FactReminder --> FinalizeOutput
33
- FinalizeOutput --> Normalization["Apply Always-On ADHD-Friendly Output Shaping (Global Normalization)"]
34
- Normalization --> End([Developer receives highly focused, concise response])
35
- BypassHarness --> End
16
+ CheckSoftware -->|No: Pure Chat / Translation / Web Search| BypassHarness["Bypass Harness Completely - Reply Directly"]
17
+ CheckSoftware -->|Yes: Code / Architecture / Project| ExecuteRouter["Run kernel-router.js OR reuse UserPromptSubmit hook output"]
18
+ ExecuteRouter --> TriageTier{Triage Tier}
19
+ TriageTier -->|Tier 1: Trivial| Tier1Route["direct-single: smallest sufficient tactic"]
20
+ TriageTier -->|Tier 2: Standard| Tier2Route["iterative-single: verify each increment"]
21
+ TriageTier -->|Tier 3: Macro| Tier3Route["fable-staged / fable-parallel / fable-multi-agent-workspace"]
22
+ Tier1Route --> Checkpoint["Surface Harness Routing Checkpoint"]
23
+ Tier2Route --> Checkpoint
24
+ Tier3Route --> Checkpoint
25
+ Checkpoint --> Evaluate["Read each suggested SKILL.md: USE FOR, DO NOT USE FOR, flow, hard rules"]
26
+ Evaluate --> Execute["Execute selected topology to resolution"]
27
+ Execute --> VerifyGate{Objective evidence supports completion?}
28
+ VerifyGate -->|Yes| Done([Evidence-backed completion])
29
+ VerifyGate -->|No| Diagnose["Diagnose / bounded re-plan"]
30
+ Diagnose --> RetryCheck{Same-signature failure x3?}
31
+ RetryCheck -->|No| Execute
32
+ RetryCheck -->|Yes| ZoomOut["zoom-out: stop edits, rebuild facts read-only, report RESUME or ESCALATE"]
33
+ ZoomOut --> Execute
36
34
  ```
37
35
 
38
36
  ---
39
37
 
40
38
  ## 2. Triggering and Routing Path
41
39
 
42
- This diagram illustrates how the `harness-everything` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
40
+ This diagram shows how the `harness-everything` skill is triggered and how it chains with companion skills. Routing suggestions are conditional on applicability; the selected topology is not advisory.
43
41
 
44
42
  ```mermaid
45
43
  graph LR
46
- UserPrompt([User Input]) --> Router["harness-everything / tier-router.js"]
47
-
48
- Router -->|Keyword Matches| Guides["Synergistic Workflow Guides"]
49
-
50
- Guides -->|TDD/Test/Bug| Ch1["tdd + environment-detection + verify-before-claim + verification-loop"]
51
- Guides -->|Git/Commit/PR| Ch2["git-commit + rewrite-commits + using-git-worktrees + verification-loop"]
52
- Guides -->|Agent/Fable/Macro| Ch3["fable-mode + fable-discipline + multi-agent-workspace"]
53
- Guides -->|Refactor/Architecture| Ch4["improve-codebase-architecture + grill-with-docs + grill-me + fable-mode"]
54
-
55
- Ch1 --> ADHD["Always-On ADHD-Friendly Output Shaping (Global Normalization)"]
56
- Ch2 --> ADHD
57
- Ch3 --> ADHD
58
- Ch4 --> ADHD
59
-
44
+ UserPrompt([User Input]) --> Router["harness-everything / kernel-router.js + tier-router.js"]
45
+
46
+ Router -->|Bug / Feature / Refactor| Ch1["tdd + todo-driven-workflow + verification-loop + verify-before-claim"]
47
+ Router -->|Commit / History / Isolation| Ch2["git-commit + rewrite-commits + using-git-worktrees + verification-loop"]
48
+ Router -->|Large / Multi-source / Multi-session| Ch3["fable-mode + fable-discipline + multi-agent-workspace + using-git-worktrees"]
49
+ Router -->|Architecture / Plan review| Ch4["improve-codebase-architecture + grill-me + grill-with-docs + to-spec + to-tickets"]
50
+
51
+ Ch1 --> Invariants["Invariants: route-before-execution, verify-before-claim, re-plan-after-x3, evaluate-before-skip, resolve-selected-workflow"]
52
+ Ch2 --> Invariants
53
+ Ch3 --> Invariants
54
+ Ch4 --> Invariants
55
+
60
56
  style Router fill:#d35400,stroke:#e67e22,stroke-width:2px,color:#ffffff
61
- style ADHD fill:#1abc9c,stroke:#16a085,stroke-width:2px,color:#ffffff
57
+ style Invariants fill:#1abc9c,stroke:#16a085,stroke-width:2px,color:#ffffff
62
58
  ```
63
59
 
64
60
  ---
65
61
 
66
62
  ## 3. Real-World Use Case Flowchart
67
63
 
68
- Here we model concrete real-world scenarios and use cases of the `harness-everything` skill, illustrating standard success paths, error handling, or recovery loops.
69
-
70
64
  ```mermaid
71
65
  graph TD
72
- Input1["User: 'Add a new settings page'"] --> Router1["tier-router.js executes"]
73
- Router1 --> TrapCheck["Trap Avoided: Feature request correctly blocked from Tier 1 degrade"]
74
- TrapCheck --> Triage2["Triaged as Tier 2: Standard Task"]
75
- Triage2 --> DomainSummon["Load 'tdd' & frontend Domain Experts"]
76
- DomainSummon --> BaseLoop["Initialize 'todo-driven-workflow' checklist"]
77
- BaseLoop --> VerifyGate["Complete feature & run 'verification-loop' pre-delivery gate"]
78
- VerifyGate --> Done1([Feature delivered safely with proof])
79
-
80
- Input2["User: 'Refactor DB architecture and grill my plan'"] --> Router2["tier-router.js executes"]
66
+ Input1["User: 'Add a new settings page'"] --> Router1["kernel-router.js executes"]
67
+ Router1 --> Triage2["Triaged as Tier 2: Standard Task"]
68
+ Triage2 --> Checkpoint1["Routing Checkpoint: tdd, todo-driven-workflow, verification-loop suggested"]
69
+ Checkpoint1 --> Eval1["Read each suggested SKILL.md; keep applicable, mark not-applicable with flow-grounded reason"]
70
+ Eval1 --> Exec1["Execute iterative-single to resolution; verify with tests before claiming done"]
71
+ Exec1 --> Done1([Feature delivered with objective evidence])
72
+
73
+ Input2["User: 'Refactor DB architecture across services'"] --> Router2["kernel-router.js executes"]
81
74
  Router2 --> Triage3["Triaged as Tier 3: Macro Task"]
82
- Triage3 --> RecGuides["Auto-load: improve-codebase-architecture, grill-with-docs, fable-mode"]
83
- RecGuides --> Process["Developer completes Grilling session to finalize ADRs"]
84
- Process --> Execute["fable-mode generates execution checklist & spawns sub-agents"]
75
+ Triage3 --> Iso["Verify linked Git worktree isolation before source mutation"]
76
+ Iso --> Exec2["fable-mode stage map + per-stage checks + cold verification"]
77
+ Exec2 --> Done2([Staged delivery with per-stage evidence])
78
+
79
+ Input3["User: 'Just fix this typo'"] --> Router3["kernel-router.js executes"]
80
+ Router3 --> Triage1["Triaged as Tier 1: Trivial Task"]
81
+ Triage1 --> Exec3["direct-single: smallest sufficient edit, then verify"]
82
+ Exec3 --> Done3([Typo fixed, no ceremony added])
85
83
  ```
86
84
 
85
+ Escape applies only to genuinely uncovered workflow scope with explicit scope + evidence; covered obligations, isolation, and independent verification survive escape. Model confidence alone never justifies skipping the selected topology.
86
+
87
87
  ---
88
88
 
89
89
  ## 4. Verification Check
90
90
 
91
91
  To ensure that the `harness-everything` skill is operating in strict compliance with Harness OS design laws, verify the following:
92
92
 
93
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
94
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
95
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
93
+ - [ ] **Route before execution**: scope/tier and smallest applicable workflow established before mutation.
94
+ - [ ] **Evaluate before omission**: each suggested skill's complete `SKILL.md` flow evaluated before deciding applicability.
95
+ - [ ] **Resolve selected workflow**: the selected topology executed to resolution; escape only for uncovered scope with evidence.
96
+ - [ ] **Verify before claim**: objective evidence (tests, checks, quoted tool output) supports completion.
97
+ - [ ] **Re-plan on repetition**: after 3 same-signature failures, `zoom-out` reflection completed before resuming.
@@ -1,68 +1,60 @@
1
1
  # Workflow: Improve Codebase Architecture
2
2
 
3
- > Finds deepening opportunities in the codebase, consolidating tightly-coupled modules and mapping dependencies visually using Mermaid diagram reports.
3
+ > Finds thin or overweight modules and reshapes them into focused, single-responsibility units by dividing large objects and functions, isolating seams, and separating interfaces.
4
4
 
5
- ---
5
+ Source of truth: `improve-codebase-architecture/SKILL.md`.
6
6
 
7
7
  ## 1. Skill Behavior Workflow
8
8
 
9
- This section visualizes how the `improve-codebase-architecture` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
9
  ```mermaid
12
10
  graph TD
13
- Start([Audit Request / Refactoring / SRP Object Splitting]) --> ScanDirectories["Scan code directories, CONTEXT.md & ADRs"]
14
- ScanDirectories --> IdentifyTarget["Identify Monolithic Objects (>300 lines) or Shallow Modules"]
15
- IdentifyTarget --> FormulatePlan["Formulate Deepening & SRP Object Extraction Plan"]
16
- FormulatePlan --> Propose["Present Deepening & SRP Proposal to User"]
17
- Propose --> UserApproved{"User Approves Proposal?"}
18
-
19
- UserApproved -->|Yes| CheckTests{"Existing Test Safety Net Present?"}
20
- UserApproved -->|No| AdjustPlan["Adjust Proposal Scope"] --> Propose
21
-
22
- CheckTests -->|No Tests| WriteCharTests["Write Characterization Tests First"] --> ExecuteTDD
23
- CheckTests -->|Tests Present| ExecuteTDD["Execute Object Extraction via TDD"]
24
-
25
- ExecuteTDD --> CheckErrors{"Cascading Errors > 3?"}
26
- CheckErrors -->|Yes| Rollback["Rollback Changes & Trigger zoom-out"]
27
- CheckErrors -->|No| Complete["Refactoring Complete & Record Lessons in self-evolve"]
11
+ RefactorAsk["Input: refactor architecture, split object, apply SRP, tech debt"] --> DiscoverScan["Scan CONTEXT.md, docs/adr/, and core interfaces first; no blind refactoring"]
12
+ DiscoverScan --> FindTargets["Target SRP violations over 300 lines or over 10 complexity, shallow modules, coupled seams"]
13
+ FindTargets --> Proposal["Present Deepening and SRP proposal: object splitting plus seam abstraction"]
14
+ Proposal --> Approved{"Proposal approved?"}
15
+ Approved -->|No| Proposal
16
+ Approved -->|Yes| SafetyNet{"Legacy code has tests?"}
17
+ SafetyNet -->|No| CharTests["Write Characterization Tests first via tdd"]
18
+ SafetyNet -->|Yes| Extract["Extract incrementally via tdd; verify tests after each change"]
19
+ CharTests --> Extract
20
+ Extract --> ErrorCheck{"More than 3 cascading errors?"}
21
+ ErrorCheck -->|Yes| Rollback["Rollback plus zoom-out; record traps in self-evolve"]
22
+ ErrorCheck -->|No| DoneState["Refactoring complete"]
28
23
  ```
29
24
 
30
- ---
31
-
32
25
  ## 2. Triggering and Routing Path
33
26
 
34
- This diagram illustrates how the `improve-codebase-architecture` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
35
-
36
27
  ```mermaid
37
28
  graph LR
38
- Router["harness-everything / tier-router.js"] -->|Keyword: refactor / architecture / couple| ICA["improve-codebase-architecture / SKILL.md"]
39
- ICA -->|Deductions challenged by SRE via| GrillMe["grill-me / SKILL.md"]
40
- ICA -->|Guides large-scale structural rewrites in| Fable["fable-mode / SKILL.md"]
41
- ICA -->|Extracts interfaces to simplify unit tests in| TDD["tdd / SKILL.md"]
29
+ TechDebt["Trigger: refactor architecture or split object or apply SRP or tech debt"] --> ICA["improve-codebase-architecture / SKILL.md"]
30
+ ICA --> TDD["tdd: Characterization Tests first, then incremental extraction"]
31
+ ICA --> ZoomOut["zoom-out: invoked with rollback after more than 3 cascading errors"]
32
+ ICA --> SelfEvolve["self-evolve: record traps"]
42
33
  ```
43
34
 
44
- ---
45
-
46
- ## 3. Real-World Use Case Flowchart
47
-
48
- Here we model concrete real-world scenarios and use cases of the `improve-codebase-architecture` skill, illustrating standard success paths, error handling, or recovery loops.
35
+ ## 3. Real-World Use Case
49
36
 
50
37
  ```mermaid
51
38
  graph TD
52
- Start["Monolithic file 'utils.js' handles email, token creation, DB pooling, and logging"] --> Trigger["improve-codebase-architecture skill analyzed"]
53
- Trigger --> Audit["Analyzes dependency graphs and calculates coupling scores"]
54
- Audit --> FindSeams["Identifies three distinct interfaces: IEmailService, ITokener, IDbPool"]
55
- FindSeams --> GenMermaid["Output detailed Mermaid diagram visualizing the proposed separated structure"]
56
- GenMermaid --> RefactorPlan["Drafts multi-stage module extraction plan"]
57
- RefactorPlan --> Done([Clear, modular architectural blueprint established])
39
+ BloatedUtil["utils.js handles email, tokens, DB pooling, logging"] --> ScanInterfaces["Scan CONTEXT.md, ADRs, core interfaces"]
40
+ ScanInterfaces --> SRPProposal["Propose split into focused units plus seam abstractions"]
41
+ SRPProposal --> CharNet["Add Characterization Tests for untested legacy paths"]
42
+ CharNet --> Incremental["Incremental extraction with test check after each step"]
43
+ Incremental --> RollbackGate{"More than 3 cascading errors?"}
44
+ RollbackGate -->|Yes| RollbackZoom["Rollback and zoom-out"]
45
+ RollbackGate -->|No| ModularDone["SRP-compliant modules with safety net"]
58
46
  ```
59
47
 
60
- ---
48
+ Concrete example: a 600-line utility module is scanned for interfaces and ADR constraints, proposed for splitting into single-purpose units, guarded by Characterization Tests, then extracted step by step with verification after each change.
61
49
 
62
- ## 4. Verification Check
50
+ Deep detail: `improve-codebase-architecture/references/README.md`.
63
51
 
64
- To ensure that the `improve-codebase-architecture` skill is operating in strict compliance with Harness OS design laws, verify the following:
52
+ ## 4. Verification Check
65
53
 
66
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
67
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
68
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
54
+ - [ ] `CONTEXT.md`, `docs/adr/`, and core interfaces scanned first; no blind refactoring
55
+ - [ ] Targets match the skill bar: SRP violations over 300 lines or over 10 complexity, shallow modules, coupled seams
56
+ - [ ] Deepening and SRP proposal with object splitting and seam abstraction presented and approved before code changes
57
+ - [ ] `tdd` launched; Characterization Tests added first when legacy code lacks tests
58
+ - [ ] Extraction done incrementally with tests verified after each change
59
+ - [ ] On more than 3 cascading errors, changes rolled back with `zoom-out` and traps recorded in `self-evolve`
60
+ - [ ] Not used for features, bugfixes, or style-only cleanups with no structure change
@@ -1,60 +1,67 @@
1
1
  # Workflow: Install Cognitive OS
2
2
 
3
- > Automates the installation of the Agent Cognitive Loop (Think > Try > Summarize > Record) into the user's active workspace and environment configs.
3
+ > Explain or explicitly apply the Harness cognitive policy: Discover, Think, Try, Summarize, Record. This skill is a human-readable/manual entry point, not an installer and not a required peer-skill selection.
4
+
5
+ Source of truth: `install-cognitive-os/SKILL.md`. Deep dive: `install-cognitive-os/references/cognitive-loop.md`.
6
+
7
+ The runtime invariant contract is established by supported host integrations independently of this skill. Domain skills never need to invoke this skill first as long as Harness invariants remain satisfied.
4
8
 
5
9
  ---
6
10
 
7
11
  ## 1. Skill Behavior Workflow
8
12
 
9
- This section visualizes how the `install-cognitive-os` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
13
  ```mermaid
12
14
  graph TD
13
- Start([Bootstrap Hook Triggered]) --> DetectTargetEnv["Scan for active IDE / Client config paths"]
14
- DetectTargetEnv --> InjectAdvisoryRules["Append advisory rules to .cursorrules, .github/copilot-instructions.md, or AGENTS.md"]
15
- InjectAdvisoryRules --> InstallHooks["Configure Claude Code settings.json hook pre-flights"]
16
- InstallHooks --> DeployScripts["Deploy core bootstrap.js, self-heal.js, and tier-router.js scripts"]
17
- DeployScripts --> RunVerification["Execute self-heal audit test to confirm platform integrations"]
18
- RunVerification --> End([Harness cognitive guardrails fully established])
15
+ Start([Explicit request OR host without kernel context]) --> Discover["Discover: verify relevant workspace state with read-only tools"]
16
+ Discover --> Think["Think: establish intent, scope, and failure modes"]
17
+ Think --> Try["Try: make the smallest useful change and gather evidence"]
18
+ Try --> Summarize["Summarize: ground conclusions in tool output"]
19
+ Summarize --> FailCheck{Same-signature failure x3?}
20
+ FailCheck -->|Yes| ZoomOut["zoom-out: stop edits, rebuild facts, report RESUME or ESCALATE"]
21
+ FailCheck -->|No| Record["Record: persist milestones only when evidence supports them"]
22
+ ZoomOut --> Think
23
+ Record --> End([Evidence-grounded work, no fixed domain sequence])
19
24
  ```
20
25
 
26
+ This skill writes no installer state, deploys no hooks, and copies no skill directories. Workspace installation is owned by the general installer (`node scripts/installer.js`), not by this skill.
27
+
21
28
  ---
22
29
 
23
30
  ## 2. Triggering and Routing Path
24
31
 
25
- This diagram illustrates how the `install-cognitive-os` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
26
-
27
32
  ```mermaid
28
33
  graph LR
29
- BootstrapCmd["Bootstrap CLI Command / npm install"] --> InstallSkill["install-cognitive-os / SKILL.md"]
30
- InstallSkill -->|Deploys core router script| Router["harness-everything / scripts / tier-router.js"]
31
- InstallSkill -->|Establishes memory loop configs for| Evolve["self-evolve / SKILL.md"]
32
- InstallSkill -->|Guards all file edits using| Todo["todo-driven-workflow / SKILL.md"]
33
- InstallSkill -->|Enforces Always-On Normalization for all responses| ADHD["Always-On ADHD-Friendly Output Shaping"]
34
+ Trigger["Explain policy / Apply loop manually / Debug cognitive behavior"] --> Skill["install-cognitive-os / SKILL.md"]
35
+ Skill -->|No kernel context| Manual["Run Discover → Think → Try → Summarize → Record explicitly"]
36
+ Skill -->|Kernel present| Policy["Treat as policy reference; domain skill proceeds directly"]
37
+ Manual --> Gates["Gates: evidence before claims; re-plan after x3 same-signature failures"]
38
+ Policy --> Gates
39
+
40
+ style Skill fill:#d35400,stroke:#e67e22,stroke-width:2px,color:#ffffff
41
+ style Gates fill:#1abc9c,stroke:#16a085,stroke-width:2px,color:#ffffff
34
42
  ```
35
43
 
36
44
  ---
37
45
 
38
46
  ## 3. Real-World Use Case Flowchart
39
47
 
40
- Here we model concrete real-world scenarios and use cases of the `install-cognitive-os` skill, illustrating standard success paths, error handling, or recovery loops.
41
-
42
48
  ```mermaid
43
49
  graph TD
44
- Start["Fresh repository checkout"] --> Trigger["Run 'node scripts/installer.js install --all --yes'"]
45
- Trigger --> Scan["Detects Cursor editor rules and GitHub action configurations"]
46
- Scan --> BuildAdvisory["Appends mandatory routing checkpoint and cognitive compliance blocks to .cursorrules"]
47
- BuildAdvisory --> CopySkills["Copies all current skills into .cursor/skills/ and .github/skills/"]
48
- CopySkills --> CheckHeal["Runs preflight audit to confirm 100% path coverage"]
49
- CheckHeal --> Done([Harness OS environment setup is complete and active])
50
- ```
50
+ Case1["User on advisory-only host: 'walk me through the loop'"] --> Explain["Explain Discover → Think → Try → Summarize → Record with a small example"]
51
+ Explain --> Done1([User can apply the loop manually])
51
52
 
52
- ---
53
+ Case2["Host without automatic kernel context"] --> Apply["Apply the five steps explicitly to the task at hand"]
54
+ Apply --> Done2([Work proceeds with evidence gates, no hook installation claimed])
55
+
56
+ Case3["User asks for domain work: 'implement feature X test-first'"] --> Direct["Proceed directly with tdd; this skill is NOT a prerequisite"]
57
+ Direct --> Done3([Domain skill executes under Harness invariants])
58
+ ```
53
59
 
54
60
  ## 4. Verification Check
55
61
 
56
62
  To ensure that the `install-cognitive-os` skill is operating in strict compliance with Harness OS design laws, verify the following:
57
63
 
58
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
59
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
60
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
64
+ - [ ] **Policy, not installation**: no hook deployment, file copying, or config mutation claimed as this skill's effect.
65
+ - [ ] **Full five-step loop**: Discover → Think → Try → Summarize → Record applied in order, not the truncated four-step variant.
66
+ - [ ] **Evidence gates honored**: completion claims need evidence; repeated same-signature failures require re-planning via `zoom-out`.
67
+ - [ ] **No prerequisite fabrication**: domain skills (`tdd`, `security-review`, `repo-docs`) proceed without selecting this skill first.
@@ -1,64 +1,53 @@
1
1
  # Workflow: Repo Docs
2
2
 
3
- > Generates high-quality, professional README.md and AGENTS.md files based on actual workspace structures and product-archetype templates.
3
+ > Creates or refreshes reader-focused README.md and AGENTS.md from real repository scans, carefully blending discovered facts with existing custom notes for projects missing docs or needing better agent onboarding.
4
4
 
5
- ---
5
+ Source of truth: `repo-docs/SKILL.md`.
6
6
 
7
7
  ## 1. Skill Behavior Workflow
8
8
 
9
- This section visualizes how the `repo-docs` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
9
  ```mermaid
12
10
  graph TD
13
- Start([Generate / Update Repository Docs]) --> AuditProjectStructure["Audit workspace directory tree & build configs"]
14
- AuditProjectStructure --> CheckExisting{Existing README / AGENTS File Found?}
15
-
16
- CheckExisting -->|Yes| ReadOld["Read Existing File & Extract Bespoke Notes (env vars, URLs, gotchas)"]
17
- CheckExisting -->|No| ClassifyProductArchetype["Classify repository archetype"]
18
-
19
- ReadOld --> ClassifyProductArchetype
20
- ClassifyProductArchetype --> LoadTemplates["Load standard README and AGENTS templates"]
21
- LoadTemplates --> SmartMerge["Smartly Merge Codebase Facts + Bespoke Notes + Template Structure"]
22
- SmartMerge --> FormatMarkdown["Format documents following clean layout rules"]
23
- FormatMarkdown --> WriteFiles["Save / Merge README.md and AGENTS.md at Root or .github/"]
24
- WriteFiles --> End([Professional onboarding documentation created without losing history])
11
+ MissingDocs["Input: missing docs or request to update README.md and AGENTS.md"] --> ScanConfigs["Scan configs such as package.json and Cargo.toml as Source of Truth; never fabricate"]
12
+ ScanConfigs --> ReadExisting["Read existing docs fully first; extract bespoke notes: env vars, URLs, gotchas"]
13
+ ReadExisting --> PickTemplate["Pick template from repo-docs/templates/ else built-in structure"]
14
+ PickTemplate --> DraftDocs["Draft README as user journey; AGENTS.md as conventions and build/test commands"]
15
+ DraftDocs --> VerifyCmds["Verify commands run; mark doubts with TODO Pending confirmation; ask via grill-me"]
16
+ VerifyCmds --> WriteRoot["Write to root; if protected use .github/AGENTS.md or docs/README.md"]
25
17
  ```
26
18
 
27
- ---
28
-
29
19
  ## 2. Triggering and Routing Path
30
20
 
31
- This diagram illustrates how the `repo-docs` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
32
-
33
21
  ```mermaid
34
22
  graph LR
35
- Router["harness-everything / tier-router.js"] -->|Keyword: doc / readme / agents-template| RepoDocs["repo-docs / SKILL.md"]
36
- RepoDocs -->|Integrates frontmatter constraints into| BMAS["multi-agent-workspace / SKILL.md"]
37
- RepoDocs -->|Leverages ADR details generated in| GWD["grill-with-docs / SKILL.md"]
23
+ UndocProject["Trigger: undocumented project needs README"] --> RepoDocs["repo-docs / SKILL.md"]
24
+ StructuralChange["Trigger: structural change needs AGENTS.md refresh"] --> RepoDocs
25
+ RepoDocs --> GrillMe["grill-me: clarify doubts marked TODO Pending confirmation"]
26
+ RepoDocs --> WriteOut["Write README.md and AGENTS.md to root or fallback locations"]
38
27
  ```
39
28
 
40
- ---
41
-
42
- ## 3. Real-World Use Case Flowchart
43
-
44
- Here we model concrete real-world scenarios and use cases of the `repo-docs` skill, illustrating standard success paths, error handling, or recovery loops.
29
+ ## 3. Real-World Use Case
45
30
 
46
31
  ```mermaid
47
32
  graph TD
48
- Start["New library lacks onboarding docs and setup details"] --> Trigger["repo-docs skill invoked"]
49
- Trigger --> Scan["Scans folders: discovers it's a TypeScript utility package"]
50
- Scan --> MatchTemplate["Loads library archetype README template"]
51
- MatchTemplate --> GenDocs["Outputs README.md with TypeScript usage examples, badges, and structure"]
52
- GenDocs --> GenOnboarding["Outputs AGENTS.md defining the developer agent rules for the repo"]
53
- GenOnboarding --> Done([Clean, standardized documentation committed])
33
+ BareRepo["New TypeScript utility package with no onboarding docs"] --> ScanProj["Scan package.json and directory tree"]
34
+ ScanProj --> PreserveNotes["Read existing stub docs; preserve custom env vars and gotchas"]
35
+ PreserveNotes --> SelectTemplate["Select library README template from repo-docs/templates/"]
36
+ SelectTemplate --> MergeDraft["Merge scan facts plus bespoke notes into README journey and AGENTS conventions"]
37
+ MergeDraft --> VerifyStep["Verify build and test commands; mark unconfirmed items TODO Pending confirmation"]
38
+ VerifyStep --> PublishDocs["Write README.md and AGENTS.md to root or fallback"]
54
39
  ```
55
40
 
56
- ---
41
+ Concrete example: an undocumented utility repo is scanned for its real entry points and scripts, its bespoke environment notes are preserved, a template from `repo-docs/templates/` shapes the draft, commands are verified, and the merged README and AGENTS files are written without blind overwrites.
57
42
 
58
- ## 4. Verification Check
43
+ Deep detail: `repo-docs/references/process-guide.md`.
59
44
 
60
- To ensure that the `repo-docs` skill is operating in strict compliance with Harness OS design laws, verify the following:
45
+ ## 4. Verification Check
61
46
 
62
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
63
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
64
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
47
+ - [ ] Configs scanned as Source of Truth; no facts fabricated without repo evidence
48
+ - [ ] Existing docs read fully first; bespoke notes preserved and never overwritten blindly
49
+ - [ ] Template picked from `repo-docs/templates/` or built-in structure applied
50
+ - [ ] `README.md` covers the user journey; `AGENTS.md` covers conventions and build/test commands
51
+ - [ ] Commands verified to run; unresolved doubts marked `// TODO: Pending confirmation` and clarified with `grill-me`
52
+ - [ ] Written to root, or to `<workspace>/.github/AGENTS.md` and `<workspace>/docs/README.md` when root is protected
53
+ - [ ] Not used for marketing copy, fabrication without scanning, or non-repository wikis