harness-everything 0.7.0 → 0.8.1
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +12 -2
- package/AGENTS.md +36 -33
- package/CHANGELOG.md +23 -0
- package/README.md +9 -8
- package/benchmarks/results/reviews/pr142-verification.json +95 -0
- package/ci/action-gate.test.js +1 -1
- package/ci/doc-capability-consistency.test.js +3 -0
- package/ci/invariant-routing.test.js +105 -34
- package/ci/mechanism-2af-worktree-isolation.test.js +152 -0
- package/ci/mechanism-2ag-router-worktree-contract.test.js +44 -0
- package/ci/mechanism-2ah-workflow-lifecycle.test.js +140 -0
- package/ci/openai-plugin-package.test.js +14 -7
- package/ci/workflow-execution-contract.test.js +60 -0
- package/docs/architecture.md +112 -106
- package/docs/mechanism-first-skill-mesh.md +93 -99
- package/docs/openai-plugin.md +1 -1
- package/docs/philosophy.md +40 -30
- package/docs/platform-capabilities.md +10 -2
- package/docs/reviews/pr-142-issue-131.md +89 -0
- package/docs/routing.md +68 -103
- package/docs/workflow-runtime.md +109 -0
- package/fable-mode/CONTRACT-FORMAT.md +3 -1
- package/fable-mode/SKILL.md +1 -1
- package/fable-mode/execution-guardrails/SKILL.md +1 -1
- package/fable-mode/fable-haiku/SKILL.md +1 -1
- package/fable-mode/fable-opus/SKILL.md +1 -1
- package/fable-mode/fable-sonnet/SKILL.md +1 -1
- package/fable-mode/scripts/workflow-plan-consumer.js +3 -1
- package/harness-everything/SKILL.md +17 -23
- package/harness-everything/references/triage-and-tiers.md +81 -98
- package/harness-everything/scripts/kernel-router-core.js +263 -0
- package/harness-everything/scripts/kernel-router.js +97 -212
- package/harness-everything/scripts/router-contract-core.js +612 -0
- package/harness-everything/scripts/router-contract.js +21 -581
- package/hooks/hooks.json +22 -1
- package/hooks/scripts/contract-test.js +24 -2
- package/hooks/scripts/lib/workflow-isolation.js +102 -0
- package/hooks/scripts/lib/workflow-runtime.js +102 -0
- package/hooks/scripts/state-persist.js +1 -0
- package/hooks/scripts/workflow-disposition.js +97 -0
- package/hooks/scripts/workflow-gate.js +53 -0
- package/hooks/scripts/workflow-stop-gate.js +44 -0
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +2 -2
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/hooks.json +20 -1
- package/plugins/harness-everything/hooks/scripts/contract-test.js +24 -2
- package/plugins/harness-everything/hooks/scripts/lib/workflow-isolation.js +102 -0
- package/plugins/harness-everything/hooks/scripts/lib/workflow-runtime.js +102 -0
- package/plugins/harness-everything/hooks/scripts/state-persist.js +1 -0
- package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +97 -0
- package/plugins/harness-everything/hooks/scripts/workflow-gate.js +53 -0
- package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +44 -0
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/scripts/lib/advisory-text.js +53 -54
- package/plugins/harness-everything/skills/fable-mode/CONTRACT-FORMAT.md +3 -1
- package/plugins/harness-everything/skills/fable-mode/SKILL.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/scripts/workflow-plan-consumer.js +3 -1
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +17 -23
- package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +81 -98
- package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js +263 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +97 -212
- package/plugins/harness-everything/skills/harness-everything/scripts/router-contract-core.js +612 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/router-contract.js +21 -581
- package/plugins/harness-everything/skills/using-git-worktrees/SKILL.md +14 -16
- package/plugins/harness-everything/skills/using-git-worktrees/references/workflow-details.md +44 -85
- package/scripts/lib/advisory-text.js +53 -54
- package/using-git-worktrees/SKILL.md +14 -16
- package/using-git-worktrees/references/workflow-details.md +44 -85
|
@@ -4,46 +4,44 @@ description: Use when starting feature work needing isolation or before implemen
|
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
metadata:
|
|
6
6
|
author: Miya Daniel
|
|
7
|
-
version: 0.
|
|
7
|
+
version: 0.8.1
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Using Git Worktrees
|
|
11
11
|
|
|
12
|
-
Use native
|
|
12
|
+
Use native worktree support first; raw Git is the fallback.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Contract
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| **Expected Output** | Isolated workspace plus clean test baseline. |
|
|
20
|
-
| **State Mutations** | Creates `.worktrees/<branch>`; updates `.gitignore` if needed. |
|
|
21
|
-
| **Enforcement Gate** | Detect existing isolation first; seamless sandbox fallback. |
|
|
16
|
+
- **Major workflow mode** — Tier 3 / Fable-class engineering must be isolated before source/artifact mutation. Reuse an existing linked worktree or create one. If isolation cannot be established, stop `BLOCKED`; never fall back to the primary working tree.
|
|
17
|
+
- **Ordinary mode** — isolation-needing feature work may honor an explicit user preference to stay in place.
|
|
18
|
+
- Never nest a worktree inside an already isolated worktree.
|
|
22
19
|
|
|
23
20
|
## Workflow
|
|
24
21
|
|
|
25
|
-
**Step 0 — Detect
|
|
22
|
+
**Step 0 — Detect isolation** (adapt per `environment-detection`):
|
|
26
23
|
```bash
|
|
27
24
|
git rev-parse --git-dir
|
|
28
25
|
git rev-parse --git-common-dir
|
|
29
26
|
git branch --show-current
|
|
30
27
|
git rev-parse --show-superproject-working-tree
|
|
31
28
|
```
|
|
32
|
-
|
|
29
|
+
Different git/common dirs and no superproject => already isolated; continue to Step 2. A submodule is a normal repo for this check.
|
|
33
30
|
|
|
34
|
-
**Step 1 — Create**: native
|
|
31
|
+
**Step 1 — Create/enter**: prefer native `EnterWorktree`, `/worktree`, or `--worktree`. Otherwise use `git worktree add "$path" -b "$BRANCH_NAME"`. For major mode, choose an already-ignored or external/sibling path so setup does not require modifying the primary tree first. Creation/entry failure => `BLOCKED`. Only ordinary mode may continue in place after an explicit decline/unsupported environment.
|
|
35
32
|
|
|
36
|
-
**Step 2 — Setup**:
|
|
33
|
+
**Step 2 — Setup**: install project dependencies as needed.
|
|
37
34
|
|
|
38
|
-
**Step 3 — Baseline**: run tests
|
|
35
|
+
**Step 3 — Baseline**: run the relevant tests/build in the isolated tree before implementation; existing failures must be surfaced before mutation proceeds.
|
|
39
36
|
|
|
40
37
|
Deep dive: <this-skill-dir>/references/workflow-details.md
|
|
41
38
|
|
|
42
39
|
## USE FOR:
|
|
40
|
+
- Tier 3 / Fable-class mutable engineering
|
|
43
41
|
- feature work needing isolation
|
|
44
42
|
- pre-implementation-plan setup
|
|
45
|
-
- native vs manual `git worktree add`
|
|
46
43
|
|
|
47
44
|
## DO NOT USE FOR:
|
|
48
45
|
- nesting inside an existing worktree
|
|
49
|
-
-
|
|
46
|
+
- read-only analysis with no mutation
|
|
47
|
+
- branch/merge workflows unrelated to workspace isolation
|
package/plugins/harness-everything/skills/using-git-worktrees/references/workflow-details.md
CHANGED
|
@@ -1,108 +1,67 @@
|
|
|
1
1
|
# Using Git Worktrees — Full Workflow Reference
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Decide whether isolation is mandatory
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Tier 3 / Fable-class engineering requires Git isolation before the first source
|
|
6
|
+
or artifact mutation. Read-only discovery may remain in the bound repository.
|
|
7
|
+
Durable multi-agent workspace state is separate: a staged run may need no
|
|
8
|
+
multi-agent workspace and still require Git isolation.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
Ordinary feature work may honor an explicit preference to stay in place.
|
|
11
|
+
Mandatory mode has no in-place fallback for a declined helper, unavailable
|
|
12
|
+
native tool, sandbox denial, or creation failure; report `blocked`.
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
CheckNative -- No --> RunGit[Try git worktree add .worktrees/branch]
|
|
14
|
+
## Detect existing isolation
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
RunGit -- Fails / Denied --> WorkInPlace[Fallback: Work in Place in Current Directory] --> Setup
|
|
17
|
-
|
|
18
|
-
Setup --> RunBaseline[4. Verify Clean Test Baseline]
|
|
19
|
-
RunBaseline --> Done[Isolated Workspace Ready]
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Step 0 detail
|
|
23
|
-
|
|
24
|
-
**Submodule guard:** `git-dir` differs from `git-common-dir` inside git submodules as well. Before concluding "already in a worktree," verify you are not in a submodule:
|
|
16
|
+
Inspect absolute Git paths and the registered worktree list:
|
|
25
17
|
|
|
26
18
|
```bash
|
|
27
|
-
|
|
19
|
+
git rev-parse --absolute-git-dir
|
|
20
|
+
git rev-parse --path-format=absolute --git-common-dir
|
|
28
21
|
git rev-parse --show-superproject-working-tree
|
|
22
|
+
git worktree list --porcelain
|
|
29
23
|
```
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Has the user already indicated their worktree preference in your instructions? If not, ask for consent before creating a worktree:
|
|
36
|
-
|
|
37
|
-
> "Would you like me to set up an isolated worktree? It protects your current branch from changes."
|
|
38
|
-
|
|
39
|
-
Honor any existing declared preference without asking. If the user declines consent, work in place and skip to project setup.
|
|
40
|
-
|
|
41
|
-
## Step 1a detail — native tools
|
|
42
|
-
|
|
43
|
-
The user has asked for an isolated workspace. Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to setup.
|
|
44
|
-
|
|
45
|
-
Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
|
|
46
|
-
|
|
47
|
-
Only use the git fallback if you have no native worktree tool available.
|
|
48
|
-
|
|
49
|
-
## Step 1b detail — directory selection priority
|
|
50
|
-
|
|
51
|
-
Follow this priority order. Explicit user preference always beats observed filesystem state.
|
|
52
|
-
|
|
53
|
-
1. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
|
|
54
|
-
2. **Check for an existing project-local worktree directory:** Check if `.worktrees/` or `worktrees/` exists using cross-platform file system tools (`read_file` / `list_dir` or native shell test commands). If found, use it. If both exist, `.worktrees` wins.
|
|
55
|
-
3. **If there is no other guidance available**, default to `.worktrees/` at the project root.
|
|
56
|
-
|
|
57
|
-
### Safety verification (project-local directories only)
|
|
58
|
-
|
|
59
|
-
**MUST verify directory is ignored before creating worktree:**
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
git check-ignore -q .worktrees || git check-ignore -q worktrees
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**If NOT ignored:** Add to .gitignore, commit the change, then proceed.
|
|
25
|
+
Reuse a registered linked checkout of the bound repository; never nest another
|
|
26
|
+
worktree inside it. A submodule or unrelated repository is not sufficient proof.
|
|
27
|
+
Record the resolved directory and branch (or detached HEAD) in the handoff.
|
|
66
28
|
|
|
67
|
-
|
|
29
|
+
## Create and enter
|
|
68
30
|
|
|
69
|
-
|
|
31
|
+
Honor an existing directory preference. Prefer a host-native worktree facility
|
|
32
|
+
when available, then verify that it is backed by a registered Git worktree.
|
|
33
|
+
Otherwise use Git:
|
|
70
34
|
|
|
71
35
|
```bash
|
|
72
|
-
|
|
73
|
-
path="$LOCATION/$BRANCH_NAME"
|
|
74
|
-
|
|
75
|
-
git worktree add "$path" -b "$BRANCH_NAME"
|
|
76
|
-
cd "$path"
|
|
36
|
+
git worktree add "<isolated-path>" -b "<task-branch>"
|
|
77
37
|
```
|
|
78
38
|
|
|
79
|
-
|
|
39
|
+
For mandatory mode, choose an already-ignored project-local path or an external
|
|
40
|
+
sibling path. Verify the exact project-local candidate with `git check-ignore`.
|
|
41
|
+
Do not edit/commit the primary tree's ignore file just to permit worktree setup.
|
|
42
|
+
If the native facility fails, a permitted Git fallback is valid; if neither can
|
|
43
|
+
establish isolation, stop mutable work as blocked.
|
|
80
44
|
|
|
81
|
-
|
|
45
|
+
Set each subsequent tool's working-directory field to the isolated path and
|
|
46
|
+
keep artifact targets inside it. Entering a worktree does not authorize an
|
|
47
|
+
absolute edit, patch move, or shell target back into the primary checkout.
|
|
48
|
+
Resolve symlinks/junctions when verifying target scope.
|
|
82
49
|
|
|
83
|
-
|
|
50
|
+
## Setup and baseline
|
|
84
51
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# Rust
|
|
90
|
-
if [ -f Cargo.toml ]; then cargo build; fi
|
|
52
|
+
Install the detected dependencies inside the isolated checkout, then run the
|
|
53
|
+
relevant baseline tests/build before implementation. Surface existing failures
|
|
54
|
+
with exact output and distinguish them from regressions introduced by the task.
|
|
55
|
+
Continue fixing task-relevant failures within the user's authorized scope.
|
|
91
56
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
# Go
|
|
97
|
-
if [ -f go.mod ]; then go mod download; fi
|
|
98
|
-
```
|
|
57
|
+
For active Fable workflows, enter the correlated run through the router's
|
|
58
|
+
displayed controller before dependency installation or artifact mutation. The
|
|
59
|
+
session's `workflow-stages.json` bootstrap file is runtime state; it is not an
|
|
60
|
+
exception for source changes.
|
|
99
61
|
|
|
100
|
-
##
|
|
62
|
+
## Evidence boundary
|
|
101
63
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Tests passing (<N> tests, 0 failures)
|
|
107
|
-
Ready to implement <feature-name>
|
|
108
|
-
```
|
|
64
|
+
The workflow gate checks registered Git identity, direct/patch target paths,
|
|
65
|
+
known shell side effects, and explicit outside paths. It is not a filesystem
|
|
66
|
+
sandbox for arbitrary script bodies or indirect side effects. Preserve the
|
|
67
|
+
platform capability boundary and report unsupported hook/metadata paths.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Prompt-injection
|
|
2
|
-
//
|
|
3
|
-
// truth for the advisory block.
|
|
1
|
+
// Prompt-injection guidance for integration paths where Harness cannot prove
|
|
2
|
+
// lifecycle-hook enforcement. Single source of truth for advisory blocks.
|
|
4
3
|
const fs = require('fs');
|
|
5
4
|
const path = require('path');
|
|
6
5
|
|
|
@@ -8,31 +7,36 @@ const MARKER = "Harness OS Guidance (Advisory)";
|
|
|
8
7
|
|
|
9
8
|
const advisoryInstructions = [
|
|
10
9
|
`\n# ${MARKER}`,
|
|
11
|
-
`This
|
|
12
|
-
`
|
|
13
|
-
`
|
|
10
|
+
`This surface cannot be assumed to mechanically enforce every Harness lifecycle transition.`,
|
|
11
|
+
`Treat the workflow contract below as required agent behavior, while keeping enforcement`,
|
|
12
|
+
`claims bounded by the host's verified capabilities.`,
|
|
14
13
|
``,
|
|
15
|
-
`## 🚦 MANDATORY ENTRY TRIAGE & ROUTING
|
|
16
|
-
`
|
|
17
|
-
`1. Run \`npx github:dyphn1/Harness-everything next "<Brief summary of user's prompt>"
|
|
18
|
-
`2.
|
|
14
|
+
`## 🚦 MANDATORY ENTRY TRIAGE & WORKFLOW ROUTING`,
|
|
15
|
+
`For every software/project prompt, load the \`harness-everything\` skill and establish the routing contract before mutation:`,
|
|
16
|
+
`1. Run \`npx github:dyphn1/Harness-everything next "<Brief summary of user's prompt>"\`. If terminal execution is unavailable, apply the same contract from the skill instead of skipping routing.`,
|
|
17
|
+
`2. For EVERY suggested skill, read its complete \`SKILL.md\` entry and resolve applicability from \`USE FOR\`, \`DO NOT USE FOR\`, workflow/basic flow, and hard rules. A name, description, router summary, or "routine/simple/already clear" judgement is not enough to omit it.`,
|
|
18
|
+
`3. The selected workflow topology is mandatory once applicable. Execute it to resolution; choose tools, reasoning, implementation technique, and decomposition freely inside it. Do not replace it with a direct path because you believe you can solve the task without the workflow.`,
|
|
19
|
+
`4. If the selected workflow genuinely cannot cover part of the task, record an explicit escape for the uncovered scope with evidence. Covered obligations remain mandatory. Host-capability loss must be surfaced, not silently converted into optional execution.`,
|
|
20
|
+
`5. Surface a compact checkpoint near the first progress update:`,
|
|
19
21
|
` \`\`\`markdown`,
|
|
20
22
|
` ## 🚦 Harness OS Routing Checkpoint`,
|
|
21
|
-
` - **Active Tier**: Tier 1
|
|
22
|
-
` - **
|
|
23
|
-
` - **
|
|
24
|
-
`
|
|
23
|
+
` - **Active Tier**: Tier 1 | Tier 2 | Tier 3 | unclassified`,
|
|
24
|
+
` - **Strategy**: <selected/deferred strategy>`,
|
|
25
|
+
` - **Workflow State**: <active | deferred | blocked | escaped>`,
|
|
26
|
+
` - **Required Invariants**: <router invariants>`,
|
|
27
|
+
` - **Suggested Skills**: <deduplicated suggestions or none>`,
|
|
28
|
+
` - **Applicability**: <use | not-applicable + reason | unresolved/unavailable>`,
|
|
29
|
+
` - **Escape**: <none | reason + uncovered scope + evidence>`,
|
|
25
30
|
` \`\`\``,
|
|
26
31
|
``,
|
|
27
|
-
`## 🤖 COGNITIVE COMPLIANCE
|
|
28
|
-
`- **
|
|
29
|
-
`- **
|
|
30
|
-
`- **
|
|
31
|
-
`- **
|
|
32
|
-
`- **
|
|
33
|
-
`- **
|
|
34
|
-
`- **
|
|
35
|
-
`- **Prefer Editing**: Prefer editing over rewriting; commit logically complete chunks rather than one giant diff.`,
|
|
32
|
+
`## 🤖 COGNITIVE COMPLIANCE`,
|
|
33
|
+
`- **No universal skill pipeline**: do not force every task through TODO/TDD/Fable. The router selects the smallest sufficient topology; suggested skills are resolved for applicability.`,
|
|
34
|
+
`- **Applicable skill flow**: reading a skill is not permission to discard it when its workflow actually applies.`,
|
|
35
|
+
`- **Pre-completion verification**: before declaring done, run \`npx github:dyphn1/Harness-everything verify\` in the project root and fix failures. An instruction-only host may not block you mechanically, but the requirement remains part of the contract.`,
|
|
36
|
+
`- **Rule of 3**: after 3 same-signature failures, stop micro-retrying and use a fresh diagnosis / zoom-out.`,
|
|
37
|
+
`- **Environment discovery**: discover OS, shell, package manager/runtime, and host capability before relying on them.`,
|
|
38
|
+
`- **Memory / self-evolve**: persist only verified reusable lessons; use escape/replan/recovery evidence to improve workflow coverage rather than bypassing the active workflow.`,
|
|
39
|
+
`- **Prefer editing**: prefer targeted edits and logically complete commits over broad rewrites.`,
|
|
36
40
|
``
|
|
37
41
|
].join('\n');
|
|
38
42
|
|
|
@@ -67,30 +71,27 @@ function injectAdvisoryText(targetFile, header, label) {
|
|
|
67
71
|
function removeAdvisoryText(targetFile) {
|
|
68
72
|
if (!fs.existsSync(targetFile)) return;
|
|
69
73
|
try {
|
|
70
|
-
|
|
74
|
+
const content = fs.readFileSync(targetFile, 'utf8');
|
|
71
75
|
const markerIndex = content.indexOf(MARKER);
|
|
72
|
-
if (markerIndex
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
if (markerIndex === -1) return;
|
|
77
|
+
let cleanContent = content;
|
|
78
|
+
const hashMarkerIndex = content.lastIndexOf('#', markerIndex);
|
|
79
|
+
if (hashMarkerIndex !== -1) cleanContent = content.substring(0, hashMarkerIndex).trim() + '\n';
|
|
80
|
+
else cleanContent = content.substring(0, markerIndex).trim() + '\n';
|
|
77
81
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
82
|
+
const lines = cleanContent.trim().split('\n').map(l => l.trim()).filter(Boolean);
|
|
83
|
+
if (lines.length === 0 || (lines.length === 1 && ['# Cursor Project Rules', '# AGENTS.md', '# Copilot Instructions', '# .hermes.md'].includes(lines[0]))) {
|
|
84
|
+
fs.unlinkSync(targetFile);
|
|
85
|
+
console.log(` ✅ Removed empty advisory file: ${targetFile}`);
|
|
86
|
+
} else {
|
|
87
|
+
fs.writeFileSync(targetFile, cleanContent.trim() + '\n', 'utf8');
|
|
88
|
+
console.log(` ✅ Removed Harness guidance from: ${targetFile}`);
|
|
86
89
|
}
|
|
87
90
|
} catch (e) {
|
|
88
91
|
console.warn(` ⚠️ Error removing advisory text from ${targetFile}: ${e.message}`);
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
// Continue gets a dedicated rule file. If a user already owns that exact
|
|
93
|
-
// path, do not replace it just because Harness chose the same filename.
|
|
94
95
|
function installContinueRule(targetFile, label) {
|
|
95
96
|
const dir = path.dirname(targetFile);
|
|
96
97
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
@@ -100,7 +101,7 @@ function installContinueRule(targetFile, label) {
|
|
|
100
101
|
`---`,
|
|
101
102
|
`name: Harness OS Guidance`,
|
|
102
103
|
`alwaysApply: true`,
|
|
103
|
-
`description: "Harness OS routing
|
|
104
|
+
`description: "Harness OS routing and workflow guidance (instruction-governed on Continue unless a lifecycle mechanism is independently verified)"`,
|
|
104
105
|
`---`,
|
|
105
106
|
advisoryInstructions.replace(/^\n/, '')
|
|
106
107
|
].join('\n');
|
|
@@ -136,26 +137,24 @@ function buildCopilotGlobalContent() {
|
|
|
136
137
|
function buildCodexGlobalContent() {
|
|
137
138
|
return [
|
|
138
139
|
`---`,
|
|
139
|
-
`description: "Harness OS Guidance - Global custom agent for orchestrating
|
|
140
|
+
`description: "Harness OS Guidance - Global custom agent for orchestrating software workflows"`,
|
|
140
141
|
`name: "Harness"`,
|
|
141
142
|
`user-invocable: true`,
|
|
142
143
|
`---`,
|
|
143
144
|
`# AGENTS.md`,
|
|
144
145
|
``,
|
|
145
146
|
`# ${MARKER}`,
|
|
146
|
-
`This
|
|
147
|
-
`enforce it mechanically (unlike Claude Code's hook-based circuit breaker). Treat`,
|
|
148
|
-
`these as strong defaults, not guarantees.`,
|
|
147
|
+
`This instruction surface cannot be assumed to provide hard lifecycle blocking.`,
|
|
149
148
|
``,
|
|
150
|
-
`- Discover the environment
|
|
151
|
-
`-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`-
|
|
155
|
-
|
|
156
|
-
`-
|
|
157
|
-
|
|
158
|
-
`- Prefer
|
|
149
|
+
`- Discover the environment and host capabilities before relying on them.`,
|
|
150
|
+
`- For software/project work, run \`npx github:dyphn1/Harness-everything next "<summary>"\` before mutation and surface the routing checkpoint.`,
|
|
151
|
+
`- Read every suggested skill's complete \`SKILL.md\` entry before resolving applicability; do not omit it from metadata or confidence alone.`,
|
|
152
|
+
`- Execute the selected workflow topology to resolution. The model controls HOW inside the topology, not WHETHER the selected topology exists.`,
|
|
153
|
+
`- Do not impose a universal TODO/TDD/Fable sequence; use the smallest selected topology plus applicable skills.`,
|
|
154
|
+
`- Escape only for genuinely uncovered workflow scope and record reason + scope + evidence.`,
|
|
155
|
+
`- Before declaring done, run \`npx github:dyphn1/Harness-everything verify\` and fix failures.`,
|
|
156
|
+
`- After 3 same-signature failures, stop retrying and use a fresh diagnosis / zoom-out.`,
|
|
157
|
+
`- Prefer targeted edits and logically complete commits.`,
|
|
159
158
|
``
|
|
160
159
|
].join('\n');
|
|
161
160
|
}
|
|
@@ -171,4 +170,4 @@ module.exports = {
|
|
|
171
170
|
removeContinueRule,
|
|
172
171
|
buildCopilotGlobalContent,
|
|
173
172
|
buildCodexGlobalContent,
|
|
174
|
-
};
|
|
173
|
+
};
|
|
@@ -4,46 +4,44 @@ description: Use when starting feature work needing isolation or before implemen
|
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
metadata:
|
|
6
6
|
author: Miya Daniel
|
|
7
|
-
version: 0.
|
|
7
|
+
version: 0.8.1
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Using Git Worktrees
|
|
11
11
|
|
|
12
|
-
Use native
|
|
12
|
+
Use native worktree support first; raw Git is the fallback.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Contract
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| **Expected Output** | Isolated workspace plus clean test baseline. |
|
|
20
|
-
| **State Mutations** | Creates `.worktrees/<branch>`; updates `.gitignore` if needed. |
|
|
21
|
-
| **Enforcement Gate** | Detect existing isolation first; seamless sandbox fallback. |
|
|
16
|
+
- **Major workflow mode** — Tier 3 / Fable-class engineering must be isolated before source/artifact mutation. Reuse an existing linked worktree or create one. If isolation cannot be established, stop `BLOCKED`; never fall back to the primary working tree.
|
|
17
|
+
- **Ordinary mode** — isolation-needing feature work may honor an explicit user preference to stay in place.
|
|
18
|
+
- Never nest a worktree inside an already isolated worktree.
|
|
22
19
|
|
|
23
20
|
## Workflow
|
|
24
21
|
|
|
25
|
-
**Step 0 — Detect
|
|
22
|
+
**Step 0 — Detect isolation** (adapt per `environment-detection`):
|
|
26
23
|
```bash
|
|
27
24
|
git rev-parse --git-dir
|
|
28
25
|
git rev-parse --git-common-dir
|
|
29
26
|
git branch --show-current
|
|
30
27
|
git rev-parse --show-superproject-working-tree
|
|
31
28
|
```
|
|
32
|
-
|
|
29
|
+
Different git/common dirs and no superproject => already isolated; continue to Step 2. A submodule is a normal repo for this check.
|
|
33
30
|
|
|
34
|
-
**Step 1 — Create**: native
|
|
31
|
+
**Step 1 — Create/enter**: prefer native `EnterWorktree`, `/worktree`, or `--worktree`. Otherwise use `git worktree add "$path" -b "$BRANCH_NAME"`. For major mode, choose an already-ignored or external/sibling path so setup does not require modifying the primary tree first. Creation/entry failure => `BLOCKED`. Only ordinary mode may continue in place after an explicit decline/unsupported environment.
|
|
35
32
|
|
|
36
|
-
**Step 2 — Setup**:
|
|
33
|
+
**Step 2 — Setup**: install project dependencies as needed.
|
|
37
34
|
|
|
38
|
-
**Step 3 — Baseline**: run tests
|
|
35
|
+
**Step 3 — Baseline**: run the relevant tests/build in the isolated tree before implementation; existing failures must be surfaced before mutation proceeds.
|
|
39
36
|
|
|
40
37
|
Deep dive: <this-skill-dir>/references/workflow-details.md
|
|
41
38
|
|
|
42
39
|
## USE FOR:
|
|
40
|
+
- Tier 3 / Fable-class mutable engineering
|
|
43
41
|
- feature work needing isolation
|
|
44
42
|
- pre-implementation-plan setup
|
|
45
|
-
- native vs manual `git worktree add`
|
|
46
43
|
|
|
47
44
|
## DO NOT USE FOR:
|
|
48
45
|
- nesting inside an existing worktree
|
|
49
|
-
-
|
|
46
|
+
- read-only analysis with no mutation
|
|
47
|
+
- branch/merge workflows unrelated to workspace isolation
|
|
@@ -1,108 +1,67 @@
|
|
|
1
1
|
# Using Git Worktrees — Full Workflow Reference
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Decide whether isolation is mandatory
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Tier 3 / Fable-class engineering requires Git isolation before the first source
|
|
6
|
+
or artifact mutation. Read-only discovery may remain in the bound repository.
|
|
7
|
+
Durable multi-agent workspace state is separate: a staged run may need no
|
|
8
|
+
multi-agent workspace and still require Git isolation.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
Ordinary feature work may honor an explicit preference to stay in place.
|
|
11
|
+
Mandatory mode has no in-place fallback for a declined helper, unavailable
|
|
12
|
+
native tool, sandbox denial, or creation failure; report `blocked`.
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
CheckNative -- No --> RunGit[Try git worktree add .worktrees/branch]
|
|
14
|
+
## Detect existing isolation
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
RunGit -- Fails / Denied --> WorkInPlace[Fallback: Work in Place in Current Directory] --> Setup
|
|
17
|
-
|
|
18
|
-
Setup --> RunBaseline[4. Verify Clean Test Baseline]
|
|
19
|
-
RunBaseline --> Done[Isolated Workspace Ready]
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Step 0 detail
|
|
23
|
-
|
|
24
|
-
**Submodule guard:** `git-dir` differs from `git-common-dir` inside git submodules as well. Before concluding "already in a worktree," verify you are not in a submodule:
|
|
16
|
+
Inspect absolute Git paths and the registered worktree list:
|
|
25
17
|
|
|
26
18
|
```bash
|
|
27
|
-
|
|
19
|
+
git rev-parse --absolute-git-dir
|
|
20
|
+
git rev-parse --path-format=absolute --git-common-dir
|
|
28
21
|
git rev-parse --show-superproject-working-tree
|
|
22
|
+
git worktree list --porcelain
|
|
29
23
|
```
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Has the user already indicated their worktree preference in your instructions? If not, ask for consent before creating a worktree:
|
|
36
|
-
|
|
37
|
-
> "Would you like me to set up an isolated worktree? It protects your current branch from changes."
|
|
38
|
-
|
|
39
|
-
Honor any existing declared preference without asking. If the user declines consent, work in place and skip to project setup.
|
|
40
|
-
|
|
41
|
-
## Step 1a detail — native tools
|
|
42
|
-
|
|
43
|
-
The user has asked for an isolated workspace. Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to setup.
|
|
44
|
-
|
|
45
|
-
Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
|
|
46
|
-
|
|
47
|
-
Only use the git fallback if you have no native worktree tool available.
|
|
48
|
-
|
|
49
|
-
## Step 1b detail — directory selection priority
|
|
50
|
-
|
|
51
|
-
Follow this priority order. Explicit user preference always beats observed filesystem state.
|
|
52
|
-
|
|
53
|
-
1. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
|
|
54
|
-
2. **Check for an existing project-local worktree directory:** Check if `.worktrees/` or `worktrees/` exists using cross-platform file system tools (`read_file` / `list_dir` or native shell test commands). If found, use it. If both exist, `.worktrees` wins.
|
|
55
|
-
3. **If there is no other guidance available**, default to `.worktrees/` at the project root.
|
|
56
|
-
|
|
57
|
-
### Safety verification (project-local directories only)
|
|
58
|
-
|
|
59
|
-
**MUST verify directory is ignored before creating worktree:**
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
git check-ignore -q .worktrees || git check-ignore -q worktrees
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**If NOT ignored:** Add to .gitignore, commit the change, then proceed.
|
|
25
|
+
Reuse a registered linked checkout of the bound repository; never nest another
|
|
26
|
+
worktree inside it. A submodule or unrelated repository is not sufficient proof.
|
|
27
|
+
Record the resolved directory and branch (or detached HEAD) in the handoff.
|
|
66
28
|
|
|
67
|
-
|
|
29
|
+
## Create and enter
|
|
68
30
|
|
|
69
|
-
|
|
31
|
+
Honor an existing directory preference. Prefer a host-native worktree facility
|
|
32
|
+
when available, then verify that it is backed by a registered Git worktree.
|
|
33
|
+
Otherwise use Git:
|
|
70
34
|
|
|
71
35
|
```bash
|
|
72
|
-
|
|
73
|
-
path="$LOCATION/$BRANCH_NAME"
|
|
74
|
-
|
|
75
|
-
git worktree add "$path" -b "$BRANCH_NAME"
|
|
76
|
-
cd "$path"
|
|
36
|
+
git worktree add "<isolated-path>" -b "<task-branch>"
|
|
77
37
|
```
|
|
78
38
|
|
|
79
|
-
|
|
39
|
+
For mandatory mode, choose an already-ignored project-local path or an external
|
|
40
|
+
sibling path. Verify the exact project-local candidate with `git check-ignore`.
|
|
41
|
+
Do not edit/commit the primary tree's ignore file just to permit worktree setup.
|
|
42
|
+
If the native facility fails, a permitted Git fallback is valid; if neither can
|
|
43
|
+
establish isolation, stop mutable work as blocked.
|
|
80
44
|
|
|
81
|
-
|
|
45
|
+
Set each subsequent tool's working-directory field to the isolated path and
|
|
46
|
+
keep artifact targets inside it. Entering a worktree does not authorize an
|
|
47
|
+
absolute edit, patch move, or shell target back into the primary checkout.
|
|
48
|
+
Resolve symlinks/junctions when verifying target scope.
|
|
82
49
|
|
|
83
|
-
|
|
50
|
+
## Setup and baseline
|
|
84
51
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# Rust
|
|
90
|
-
if [ -f Cargo.toml ]; then cargo build; fi
|
|
52
|
+
Install the detected dependencies inside the isolated checkout, then run the
|
|
53
|
+
relevant baseline tests/build before implementation. Surface existing failures
|
|
54
|
+
with exact output and distinguish them from regressions introduced by the task.
|
|
55
|
+
Continue fixing task-relevant failures within the user's authorized scope.
|
|
91
56
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
# Go
|
|
97
|
-
if [ -f go.mod ]; then go mod download; fi
|
|
98
|
-
```
|
|
57
|
+
For active Fable workflows, enter the correlated run through the router's
|
|
58
|
+
displayed controller before dependency installation or artifact mutation. The
|
|
59
|
+
session's `workflow-stages.json` bootstrap file is runtime state; it is not an
|
|
60
|
+
exception for source changes.
|
|
99
61
|
|
|
100
|
-
##
|
|
62
|
+
## Evidence boundary
|
|
101
63
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Tests passing (<N> tests, 0 failures)
|
|
107
|
-
Ready to implement <feature-name>
|
|
108
|
-
```
|
|
64
|
+
The workflow gate checks registered Git identity, direct/patch target paths,
|
|
65
|
+
known shell side effects, and explicit outside paths. It is not a filesystem
|
|
66
|
+
sandbox for arbitrary script bodies or indirect side effects. Preserve the
|
|
67
|
+
platform capability boundary and report unsupported hook/metadata paths.
|