harness-everything 0.11.5 → 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 (55) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +32 -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 +314 -8
  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/hooks.json +25 -1
  35. package/hooks/scripts/lib/workflow-isolation.js +111 -6
  36. package/hooks/scripts/lib/workflow-runtime.js +138 -2
  37. package/hooks/scripts/rule-of-3-tracker.js +17 -9
  38. package/hooks/scripts/state-persist.js +52 -9
  39. package/hooks/scripts/workflow-gate.js +22 -7
  40. package/hooks/scripts/workflow-mutation-denied.js +17 -0
  41. package/opencode-plugin/plugin.json +1 -1
  42. package/package.json +1 -1
  43. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  44. package/plugins/harness-everything/hooks/hooks.json +1 -1
  45. package/plugins/harness-everything/hooks/scripts/lib/workflow-isolation.js +111 -6
  46. package/plugins/harness-everything/hooks/scripts/lib/workflow-runtime.js +138 -2
  47. package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +17 -9
  48. package/plugins/harness-everything/hooks/scripts/state-persist.js +52 -9
  49. package/plugins/harness-everything/hooks/scripts/workflow-gate.js +22 -7
  50. package/plugins/harness-everything/hooks/scripts/workflow-mutation-denied.js +17 -0
  51. package/plugins/harness-everything/plugin.json +1 -1
  52. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  53. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +38 -10
  54. package/docs/issue-20-rollup.md +0 -47
  55. package/docs/reviews/pr-142-issue-131.md +0 -89
@@ -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
@@ -1,60 +1,64 @@
1
1
  # Workflow: Rewrite Commits
2
2
 
3
- > Safely rewrites or squashes a specified range of commits into highly professional, Conventional Commits (Angular style) on a new branch.
3
+ > Rewrites past Git history into Angular Style messages — cleaning unpushed commits before a PR, squashing fixups, rewording, and reordering safely on a temp branch with abort on conflict.
4
+
5
+ Source of truth: `rewrite-commits/SKILL.md`.
4
6
 
5
7
  ---
6
8
 
7
9
  ## 1. Skill Behavior Workflow
8
10
 
9
- This section visualizes how the `rewrite-commits` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
11
  ```mermaid
12
12
  graph TD
13
- Start([Define Commit Range]) --> BackupBranch["Create a backup branch of current state"]
14
- BackupBranch --> ReadCommits["Read all commit messages in the range"]
15
- ReadCommits --> AnalyzeDiffs["Read files & diffs associated with each commit"]
16
- AnalyzeDiffs --> GenNewMessages["Generate high-quality Angular-style messages for each diff"]
17
- GenNewMessages --> SoftReset["Execute git reset --soft to merge range changes"]
18
- SoftReset --> ReapplyCommits["Re-apply changes with perfectly clean, segmented commit history"]
19
- ReapplyCommits --> VerifyBranch["Run verification checks on the final rebuilt branch"]
20
- VerifyBranch --> End([Perfectly clean Git history on new branch])
13
+ DiscoverRange["Discover: git log --oneline -n <num> to confirm range"] --> PushedGuard{"Pushed to remote main/master?"}
14
+ PushedGuard -->|Yes| WarnConfirm["Warn and require secondary human confirmation"]
15
+ PushedGuard -->|No| TempBranch["Create temp branch for rewrite"]
16
+ WarnConfirm --> TempBranch
17
+ TempBranch --> ResetSoft["Rewrite via git reset --soft HEAD~N plus structured commits"]
18
+ ResetSoft --> AngularMsg["Messages follow Angular Style per git-commit skill"]
19
+ AngularMsg --> ConfirmLog["Confirm with git log --oneline"]
20
+ ConfirmLog --> ConflictCheck{"Merge conflict?"}
21
+ ConflictCheck -->|Yes| AbortStop["Run git rebase --abort, STOP, hand to human or zoom-out"]
22
+ ConflictCheck -->|No| DoneHistory["Rewritten Angular-Style history on temp branch"]
21
23
  ```
22
24
 
23
- ---
25
+ ```mermaid
26
+ graph TD
27
+ NoRebaseI["Gate: no bare interactive git rebase -i"] --> ScriptOpt["Use git reset --soft or Node.js scripting, no hardcoded sed -i"]
28
+ ScriptOpt --> DeepRef["Deep dive: rewrite-commits/references/workflow.md"]
29
+ DeepRef --> ConfirmOut["Expected output: temp-branch history confirmed via git log --oneline"]
30
+ ```
24
31
 
25
32
  ## 2. Triggering and Routing Path
26
33
 
27
- This diagram illustrates how the `rewrite-commits` 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.
28
-
29
34
  ```mermaid
30
35
  graph LR
31
- Router["harness-everything / tier-router.js"] -->|Keyword: commit / rewrite / squash| Rewrite["rewrite-commits / SKILL.md"]
32
- Rewrite -->|Supplements convention templates in| GitCommit["git-commit / SKILL.md"]
33
- Rewrite -->|Pre-verify rewritten commits via| VerLoop["verification-loop / SKILL.md"]
36
+ UserReq["User requests cleaning, squashing, or rewriting past history to Angular Style"] --> RewriteSkill["rewrite-commits / SKILL.md"]
37
+ RewriteSkill --> TempOut["Output: rewritten history on temp branch"]
38
+ RewriteSkill --> AbortPath["On conflict: git rebase --abort + handover"]
34
39
  ```
35
40
 
36
- ---
37
-
38
- ## 3. Real-World Use Case Flowchart
39
-
40
- Here we model concrete real-world scenarios and use cases of the `rewrite-commits` skill, illustrating standard success paths, error handling, or recovery loops.
41
-
42
41
  ```mermaid
43
- graph TD
44
- Start["Branch has messy commits: 'fixed stuff', 'more fixes', 'bug'"] --> Trigger["Rewrite-commits skill run for HEAD~3"]
45
- Trigger --> Backup["Backup branch 'backup-feature-x' created"]
46
- Trigger --> GatherDiffs["Analyze total diff across the 3 messy commits"]
47
- GatherDiffs --> Generate完美["Determine changes relate to user auth session handling"]
48
- Generate完美 --> Rebuild["Reset and make 1 perfect commit: 'fix(auth): correct token refresh race condition'"]
49
- Rebuild --> Done([Clean, reviewable PR history ready])
42
+ graph LR
43
+ RewriteSkill2["rewrite-commits / SKILL.md"] -->|Message conventions per| GitCommit["git-commit skill"]
44
+ RewriteSkill2 -->|Conflict handover to| ZoomOut["zoom-out"]
45
+ NewCommitReq["New commits on current work"] -->|Not this skill| GitCommit
46
+ PushedMain["Rewrite of pushed main/master without confirmation"] -->|Blocked| NeedConfirm["Require explicit human confirmation"]
50
47
  ```
51
48
 
52
- ---
49
+ ## 3. Real-World Use Case
53
50
 
54
- ## 4. Verification Check
51
+ A branch has 4 messy unpushed commits before a PR (`wip`, `fix`, `oops`, `final fix`). The user asks to squash to Angular Style. The skill runs `git log --oneline -n 4` to confirm the range, verifies the commits are not pushed to `main`, creates a temp branch, uses `git reset --soft HEAD~4` plus structured recommits with Angular Style messages, then confirms with `git log --oneline`. If a rebase conflict appears, it runs `git rebase --abort`, stops, and hands over for a human decision.
55
52
 
56
- To ensure that the `rewrite-commits` skill is operating in strict compliance with Harness OS design laws, verify the following:
53
+ ## 4. Verification Check
57
54
 
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.
55
+ - [ ] Range confirmed with `git log --oneline -n <num>` before rewriting
56
+ - [ ] Rewrite done on a temp branch first, not directly on `main` / release branches
57
+ - [ ] No bare interactive `git rebase -i` used; used `git reset --soft HEAD~<N>` or script editors
58
+ - [ ] No hardcoded `sed -i` scripting used
59
+ - [ ] All new messages follow Angular Style per the `git-commit` skill
60
+ - [ ] Final history confirmed with `git log --oneline`
61
+ - [ ] If commits were pushed to remote `main` / `master`, warned and obtained secondary human confirmation
62
+ - [ ] On merge conflict, ran `git rebase --abort`, stopped, and handed over instead of resolving beyond abort
63
+ - [ ] Not used for creating new commits on current work (belongs to `git-commit`)
64
+ - [ ] Deep detail checked in `rewrite-commits/references/workflow.md` where needed
@@ -1,77 +1,58 @@
1
1
  # Workflow: Security Review
2
2
 
3
- > Automated security scanning, threat modeling, and input-validation reviews to identify potential security holes and enforce robust safety guardrails.
3
+ > Runs STRIDE threat modeling, scans secrets with the audit script, and hardens code against OWASP Top 10 risks using three-tier boundary controls — for auth, inputs, uploads, secrets, and pre-deploy audits.
4
+
5
+ Source of truth: `security-review/SKILL.md`.
4
6
 
5
7
  ---
6
8
 
7
9
  ## 1. Skill Behavior Workflow
8
10
 
9
- This section visualizes how the `security-review` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
11
  ```mermaid
12
12
  graph TD
13
- Start([Code Refactoring / Feature Done / Security Audit]) --> STRIDE["1. STRIDE Threat Modeling & Abuse Case Design"]
14
- STRIDE --> CheckScript{2. Is audit-secrets.js Executable?}
15
-
16
- CheckScript -->|Yes| RunAudit["Run node security-review/scripts/audit-secrets.js"]
17
- CheckScript -->|No / Fails| GrepFallback["Scan Workspace Secrets & Inputs via grep_search"]
18
-
19
- RunAudit --> CheckVun{3. Detect Vulnerabilities or Leaks?}
20
- GrepFallback --> CheckVun
21
-
22
- CheckVun -->|Hardcoded Secrets| FixSecrets["Always Do: Refactor to process.env & .env.local"]
23
- CheckVun -->|SQL Concatenation| FixSQL["Always Do: Refactor to Parameterized Queries / ORM"]
24
- CheckVun -->|Unvalidated Input| FixInput["Always Do: Add Zod Schema Validation"]
25
- CheckVun -->|High-Risk Auth Shift| AskUser["Ask First: Require User Approval for Auth Shift"]
26
-
27
- FixSecrets --> CompileSecurityReport["4. Compile Security Audit Report"]
28
- FixSQL --> CompileSecurityReport
29
- FixInput --> CompileSecurityReport
30
- AskUser -->|Approved| CompileSecurityReport
31
- CheckVun -->|Clean| CompileSecurityReport
32
-
33
- CompileSecurityReport --> ResolveReportPath{5. Resolve Audit Report Path}
34
- ResolveReportPath -->|docs/ Exists| WriteDocs["Save to docs/security-audit.md"]
35
- ResolveReportPath -->|Protected / No Folder| WritePlatform["Save to .github/harness-everything/security-audit.md"]
36
-
37
- WriteDocs --> End([Codebase hardened and verified secure])
38
- WritePlatform --> End
13
+ ThreatModel["Threat-model with STRIDE per guides/STRIDE-THREAT-MODEL.md; misuse-case every endpoint and input"] --> SecretScan["Scan secrets and injection risks with audit script"]
14
+ SecretScan --> FixHarden["Fix findings per boundary system"]
15
+ FixHarden --> AuditReport["Write audit report to docs or platform dir"]
16
+ AuditReport --> DoneSecure["Codebase hardened; report recorded"]
39
17
  ```
40
18
 
41
- ---
19
+ ```mermaid
20
+ graph TD
21
+ ScanCmd["Run node security-review/scripts/audit-secrets.js"] --> ScanGate["Gate: secret scan via script or grep before concluding"]
22
+ ScanGate --> AlwaysDo["Always Do: parameterize SQL, Zod-validate inputs, httpOnly cookies, secrets to process.env"]
23
+ AlwaysDo --> NeverDo["Never Do: no hardcoded secrets, no password logging, no eval or unescaped innerHTML"]
24
+ NeverDo --> ReportPath["Report to docs/security-audit.md or .github/harness-everything/security-audit.md"]
25
+ ```
42
26
 
43
27
  ## 2. Triggering and Routing Path
44
28
 
45
- This diagram illustrates how the `security-review` 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.
46
-
47
29
  ```mermaid
48
30
  graph LR
49
- Router["harness-everything / tier-router.js"] -->|Pre-flight / Quality PR reviews| SecReview["security-review / SKILL.md"]
50
- SecReview -->|Informs security tests written in| TDD["tdd / SKILL.md"]
51
- SecReview -->|Integrated as mandatory PR gate in| VerLoop["verification-loop / SKILL.md"]
31
+ AuthReq["AuthN or authZ implementation"] --> SecSkill["security-review / SKILL.md"]
32
+ InputReq["User input, uploads, new API endpoints"] --> SecSkill
33
+ SecretReq["Secrets, credentials, payment features"] --> SecSkill
34
+ AuditReq["Security audit before production deploy"] --> SecSkill
52
35
  ```
53
36
 
54
- ---
55
-
56
- ## 3. Real-World Use Case Flowchart
57
-
58
- Here we model concrete real-world scenarios and use cases of the `security-review` skill, illustrating standard success paths, error handling, or recovery loops.
59
-
60
37
  ```mermaid
61
- graph TD
62
- Start["New search feature: executes system shell query using raw user input string"] --> Trigger["security-review skill runs"]
63
- Trigger --> Scan["Flags potential command injection vulnerability in search.js"]
64
- Scan --> Propose["Propose input sanitization and switching to child_process.execFile with argument array"]
65
- Propose --> Implement["Refactor code to use safe argument arrays instead of raw string shell execution"]
66
- Implement --> Done([Critical remote code execution vulnerability resolved])
38
+ graph LR
39
+ SecSkill2["security-review / SKILL.md"] -->|Produces| ThreatOut["Threat model + scan + hardened code + audit report"]
40
+ PerfReq["Performance profiling"] -->|Out of scope| NotSec["Not security-review"]
41
+ A11yReq["Accessibility or UI styling fixes"] -->|Out of scope| NotSec
42
+ PlainReview["Code review without security scope"] -->|Out of scope| NotSec
67
43
  ```
68
44
 
69
- ---
45
+ ## 3. Real-World Use Case
70
46
 
71
- ## 4. Verification Check
47
+ A new profile endpoint accepts a username and avatar upload before a production deploy. The skill threat-models it with STRIDE, misuse-cases the input and upload path, runs `node "security-review/scripts/audit-secrets.js"`, finds an unvalidated input and a hardcoded secret, fixes them per the boundary system (Zod validation, secret moved to `process.env`, parameterized query), and writes the report to `<workspace>/docs/security-audit.md`, falling back to `<workspace>/.github/harness-everything/security-audit.md` when `docs/` is protected or absent.
72
48
 
73
- To ensure that the `security-review` skill is operating in strict compliance with Harness OS design laws, verify the following:
49
+ ## 4. Verification Check
74
50
 
75
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
76
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
77
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
51
+ - [ ] STRIDE threat model completed per `security-review/guides/STRIDE-THREAT-MODEL.md`, with misuse-case for every endpoint and input
52
+ - [ ] Secret and injection scan run via `security-review/scripts/audit-secrets.js`, or grep, before concluding
53
+ - [ ] OWASP patterns checked per `security-review/guides/OWASP-PATTERNS.md` and `security-review/references/security-checklist.md`
54
+ - [ ] Always Do applied: parameterized SQL, Zod-validated inputs, httpOnly cookies, secrets in `process.env`
55
+ - [ ] Ask First respected: CORS changes, auth and login flows, file uploads, rate limits
56
+ - [ ] Never Do respected: no committed hardcoded secrets, no logged passwords or tokens, no `eval()` or unescaped `innerHTML`
57
+ - [ ] Audit report written to `<workspace>/docs/security-audit.md`, or `<workspace>/.github/harness-everything/security-audit.md` when docs is protected or absent
58
+ - [ ] Scope kept to auth, inputs, uploads, endpoints, secrets, and audits — not general review, performance, or UI styling