@harness-forge/cli 1.2.1 → 1.2.2

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/AGENTS.md CHANGED
@@ -11,6 +11,8 @@ Use the thin visible bridge surfaces first in installed workspaces:
11
11
  - `.hforge/templates/` for canonical installed task and workflow templates
12
12
  - `.hforge/runtime/index.json` and `.hforge/runtime/README.md` for shared runtime state and bridge resolution
13
13
  - `.hforge/generated/agent-command-catalog.json` for safe command discovery
14
+ - `docs/agent-usage-playbook.md` for concrete command-resolution guidance, operator prompts, and examples that promote actual Harness Forge usage
15
+ - `commands/hforge-analyze.md` for runtimes that support slash-style markdown command entrypoints such as `/hforge-analyze`
14
16
 
15
17
  ## Mode awareness
16
18
 
@@ -117,3 +119,8 @@ Use the thin visible bridge surfaces first in installed workspaces:
117
119
  ## Release gate
118
120
 
119
121
  - run `npm run validate:release` before publish, handoff, or release-signoff work
122
+
123
+ ## Usage promotion
124
+
125
+ - if an operator wants stronger Harness Forge usage in day-to-day agent work, use `docs/agent-usage-playbook.md`
126
+ - prefer the playbook prompts when you want the agent to prove it is reading the installed guidance layer, use the command catalog, create task artifacts, write decision records, or escalate into recursive mode
package/README.md CHANGED
@@ -714,6 +714,22 @@ When integrating a custom agent, start here:
714
714
  5. `.agents/skills/<skill>/SKILL.md`
715
715
  6. `.hforge/library/skills/<skill>/SKILL.md`
716
716
 
717
+ ## 🧠 Agent Usage Playbook
718
+
719
+ If you want Claude Code, Codex, or another custom agent to use Harness Forge
720
+ more explicitly instead of merely coexisting with it, use
721
+ `docs/agent-usage-playbook.md`.
722
+
723
+ That playbook includes:
724
+
725
+ - launcher-aware command resolution when `hforge` is not on `PATH`
726
+ - concrete operator prompts that tell agents to read the installed runtime
727
+ - examples for task artifacts, decision records, recursive mode, and support verification
728
+
729
+ In runtimes that expose packaged markdown commands, Harness Forge can also ship
730
+ triggerable command docs such as `/hforge-analyze`, alongside supporting
731
+ command surfaces like `commands/plan.md` and `commands/test.md`.
732
+
717
733
  ---
718
734
 
719
735
  ## 🙌 Acknowledgements
@@ -0,0 +1,55 @@
1
+ ---
2
+ id: command-hforge-analyze
3
+ kind: command
4
+ title: Harness Analyze Command
5
+ summary: Use when an agent should inspect the installed Harness Forge runtime before planning, coding, or making support claims.
6
+ status: stable
7
+ owner: core
8
+ applies_to:
9
+ - codex
10
+ - claude-code
11
+ - cursor
12
+ - opencode
13
+ languages:
14
+ - all
15
+ generated: false
16
+ ---
17
+ # Harness Analyze Command
18
+
19
+ ## Syntax
20
+
21
+ Invoke this command in runtimes that support markdown-backed command entrypoints,
22
+ for example `/hforge-analyze` followed by the active task, goal, or repo
23
+ question.
24
+
25
+ ## Arguments and options
26
+
27
+ - include the current task, feature, bug, or investigation objective
28
+ - include the workspace root when the runtime is not already scoped to the repo
29
+ - prefer installed runtime inspection before implementation or support claims
30
+
31
+ ## Expected workflow
32
+
33
+ 1. inspect `AGENTS.md`, `.hforge/agent-manifest.json`, and `.hforge/generated/agent-command-catalog.json`
34
+ 2. resolve command execution through `.hforge/generated/bin/hforge(.cmd|.ps1)` first, bare `hforge` second, and `npx @harness-forge/cli` last
35
+ 3. run the most relevant repo-intelligence and health commands, typically `status`, `commands`, `recommend`, and `review`
36
+ 4. read `.hforge/runtime/repo/repo-map.json`, `.hforge/runtime/repo/recommendations.json`, and any task or recursive runtime surfaces that apply
37
+ 5. summarize what the installed Harness Forge runtime says before editing files
38
+
39
+ ## Output contract
40
+
41
+ - active Harness Forge surfaces called out explicitly
42
+ - command resolution path stated explicitly
43
+ - relevant runtime artifacts and recommendation evidence summarized
44
+ - clear next step suggested: implement, create task artifacts, write a decision record, or escalate into recursive mode
45
+
46
+ ## Side effects
47
+
48
+ - may run read-oriented CLI commands such as `status`, `commands`, `recommend`, `review`, `task`, or `recursive capabilities`
49
+ - should remain diagnostic-first unless the operator explicitly asks for task artifacts, decisions, or recursive runs
50
+
51
+ ## Failure behavior
52
+
53
+ - if the workspace is not initialized, say so and recommend `npx @harness-forge/cli` or `hforge init`
54
+ - if bare `hforge` is unavailable, fall back to the workspace launcher or `npx @harness-forge/cli`
55
+ - do not claim support or runtime state that is not present in the installed surfaces
@@ -0,0 +1,198 @@
1
+ # Agent Usage Playbook
2
+
3
+ Harness Forge is most useful when the agent treats it as an explicit operating
4
+ layer rather than passive repo decoration.
5
+
6
+ This playbook shows how to promote actual usage in installed workspaces, how to
7
+ run commands even when bare `hforge` is not on `PATH`, and what prompts to give
8
+ Claude Code or Codex so they use the installed runtime instead of falling back
9
+ to ad-hoc repo exploration.
10
+
11
+ ## Command resolution rule
12
+
13
+ Inside an installed workspace, agents should resolve Harness Forge commands in
14
+ this order:
15
+
16
+ 1. `.hforge/generated/bin/hforge.cmd` or `.ps1` on Windows, or `./.hforge/generated/bin/hforge` on POSIX
17
+ 2. bare `hforge`
18
+ 3. `npx @harness-forge/cli`
19
+
20
+ That means a global install is optional. Agents can still run the package
21
+ reliably through the workspace-local launcher.
22
+
23
+ ## Slash-style command trigger
24
+
25
+ In runtimes that support markdown command entrypoints, Harness Forge can also
26
+ be promoted through `/hforge-analyze`.
27
+
28
+ That command is backed by `commands/hforge-analyze.md` and is intended to make
29
+ the agent:
30
+
31
+ - inspect the installed Harness Forge runtime first
32
+ - choose a safe command execution path
33
+ - summarize active guidance, targets, repo intelligence, and next steps before coding
34
+
35
+ ## What usage looks like
36
+
37
+ An agent is usually using Harness Forge well when it does at least some of the
38
+ following:
39
+
40
+ - reads `AGENTS.md`, `CLAUDE.md`, or target bridge files before acting
41
+ - checks `.hforge/agent-manifest.json` or `.hforge/generated/agent-command-catalog.json`
42
+ - uses `status`, `commands`, `recommend`, `review`, `task`, or `recursive` instead of inventing unsupported commands
43
+ - reads `.hforge/runtime/repo/repo-map.json` or `.hforge/runtime/repo/recommendations.json` before making support claims
44
+ - writes durable artifacts only when the workflow actually calls for them
45
+
46
+ ## Important limitation
47
+
48
+ Normal agent work does not automatically populate every Harness Forge runtime
49
+ folder.
50
+
51
+ For example:
52
+
53
+ - `.hforge/runtime/tasks/` only fills when task-runtime flows are used
54
+ - `.hforge/runtime/decisions/` only fills when ASR or ADR style decision records are written
55
+ - `.hforge/runtime/recursive/sessions/` only fills when recursive mode is explicitly used
56
+
57
+ So an empty task or decision folder does not automatically mean the agent is
58
+ ignoring Harness Forge. It often means the agent is using the guidance layer
59
+ but has not yet been asked to persist structured runtime artifacts.
60
+
61
+ ## Recommended first commands
62
+
63
+ These are the best low-friction commands to promote actual package usage:
64
+
65
+ ```bash
66
+ hforge status --root . --json
67
+ hforge commands --json
68
+ hforge recommend . --json
69
+ hforge review --root . --json
70
+ ```
71
+
72
+ If the repo already has meaningful complexity:
73
+
74
+ ```bash
75
+ hforge cartograph . --json
76
+ hforge classify-boundaries . --json
77
+ hforge synthesize-instructions . --target claude-code --json
78
+ ```
79
+
80
+ If the task is hard or multi-hop:
81
+
82
+ ```bash
83
+ hforge recursive plan "investigate the issue" --task-id TASK-001 --root . --json
84
+ hforge recursive capabilities --root . --json
85
+ ```
86
+
87
+ ## Prompt patterns
88
+
89
+ ### 1. Prove that the agent is using Harness Forge
90
+
91
+ Use this when you want the agent to confirm it is reading the installed layer:
92
+
93
+ ```text
94
+ Before making changes, inspect CLAUDE.md, AGENTS.md, and .hforge/agent-manifest.json.
95
+ Tell me which Harness Forge surfaces are active in this repo, which command form
96
+ you will use, and which hidden runtime files you consider authoritative.
97
+ ```
98
+
99
+ ### 2. Force command-aware behavior
100
+
101
+ Use this when the agent tends to improvise commands:
102
+
103
+ ```text
104
+ Use the installed Harness Forge command catalog before inventing commands.
105
+ Resolve execution through .hforge/generated/bin/hforge first, then bare hforge,
106
+ then npx @harness-forge/cli. Show me the command you chose before running it.
107
+ ```
108
+
109
+ ### 3. Force repo-aware guidance before coding
110
+
111
+ Use this when you want the agent to inspect the workspace before implementation:
112
+
113
+ ```text
114
+ Use Harness Forge to inspect this repo before coding. Run status, commands, and
115
+ recommend, then summarize what the installed runtime says about targets, risks,
116
+ and recommended operating surfaces before you edit files.
117
+ ```
118
+
119
+ ### 4. Create durable task artifacts
120
+
121
+ Use this when you want visible runtime evidence for a feature or bug:
122
+
123
+ ```text
124
+ Treat this work as a tracked Harness Forge task. Create a task id, inspect the
125
+ repo using the installed runtime, and persist task-runtime artifacts for file
126
+ interest, impact analysis, and task pack output before implementation.
127
+ ```
128
+
129
+ ### 5. Create decision records
130
+
131
+ Use this when the work changes architecture, workflow, or support posture:
132
+
133
+ ```text
134
+ If this task changes architecture, release posture, workflow contracts, or AI
135
+ runtime behavior, write a Harness Forge decision record under
136
+ .hforge/runtime/decisions and summarize the rationale in the response.
137
+ ```
138
+
139
+ ### 6. Escalate into recursive mode
140
+
141
+ Use this when the work is ambiguous or investigation-heavy:
142
+
143
+ ```text
144
+ This is a hard investigation task. Use Harness Forge recursive mode instead of
145
+ chat-only reasoning. Plan a recursive session, inspect recursive capabilities,
146
+ run one bounded structured analysis step, and return the durable run result.
147
+ ```
148
+
149
+ ### 7. Keep the agent honest about support claims
150
+
151
+ Use this when the task touches target support or language behavior:
152
+
153
+ ```text
154
+ Do not guess target or language support. Use Harness Forge capability surfaces,
155
+ including .hforge/runtime/recursive/language-capabilities.json and target inspect
156
+ output, before claiming that Claude Code, Codex, Cursor, or OpenCode supports a
157
+ behavior.
158
+ ```
159
+
160
+ ## Claude-specific examples
161
+
162
+ ```text
163
+ Use CLAUDE.md as the Claude-native bridge, but keep AGENTS.md as the shared
164
+ cross-agent contract. Before implementing, inspect the installed Harness Forge
165
+ runtime and tell me which launcher or command form you will use.
166
+ ```
167
+
168
+ ```text
169
+ Use Harness Forge as your repo operating layer for this task. Read CLAUDE.md,
170
+ AGENTS.md, and .hforge/generated/agent-command-catalog.json, then use status,
171
+ recommend, and review before you write code.
172
+ ```
173
+
174
+ ## Codex-specific examples
175
+
176
+ ```text
177
+ Use AGENTS.md and the installed Harness Forge command catalog before editing.
178
+ If hforge is not on PATH, use the workspace launcher under .hforge/generated/bin.
179
+ Prefer Harness Forge repo-intelligence commands over blind repo scanning.
180
+ ```
181
+
182
+ ```text
183
+ Use Harness Forge to bootstrap your understanding of this repo: inspect command
184
+ availability, review installed targets, run recommendation and repo-map flows,
185
+ and base your plan on the installed runtime outputs instead of assumptions.
186
+ ```
187
+
188
+ ## Best operator habit
189
+
190
+ If you want agents to use Harness Forge more consistently, make that an explicit
191
+ instruction at the start of important tasks:
192
+
193
+ ```text
194
+ Use the installed Harness Forge runtime for this task, not just the repo files.
195
+ Inspect the active guidance surfaces first, resolve the safest command form, and
196
+ persist structured artifacts when the task crosses into tracked work,
197
+ architecture decisions, or recursive investigation.
198
+ ```
package/docs/agents.md CHANGED
@@ -17,6 +17,8 @@ AI content into the hidden `.hforge/` layer.
17
17
  - `.hforge/runtime/recursive/language-capabilities.json` for the canonical
18
18
  recursive structured-analysis capability map before deeper recursive
19
19
  investigation begins
20
+ - `docs/agent-usage-playbook.md` for copy-ready prompts and examples that make
21
+ agents use the installed Harness Forge runtime more explicitly
20
22
  - `docs/authoring/enhanced-skill-import.md` for curated research and validation provenance behind imported skill upgrades
21
23
  - `RESEARCH-SOURCES.md` and `VALIDATION.md` for optional pack-level provenance detail
22
24
 
package/docs/commands.md CHANGED
@@ -62,6 +62,19 @@ For agents inside an installed workspace, the safest execution order is:
62
62
  2. bare `hforge`
63
63
  3. `npx @harness-forge/cli`
64
64
 
65
+ ## Markdown command entrypoints
66
+
67
+ Some agent runtimes support markdown-backed command triggers in addition to the
68
+ CLI. Harness Forge ships command docs for those environments under `commands/`.
69
+
70
+ Examples:
71
+
72
+ - `/hforge-analyze` to force installed-runtime inspection before coding
73
+ - `commands/hforge-analyze.md` as the canonical packaged command surface
74
+ - `commands/plan.md` and `commands/test.md` for broader planning and validation guidance
75
+
76
+ Treat these as agent-facing prompt entrypoints, not replacements for the CLI.
77
+
65
78
  ```bash
66
79
  npx @harness-forge/cli
67
80
  npx @harness-forge/cli shell setup --yes
@@ -116,6 +129,9 @@ under `.hforge/state/`, and intentionally preserve gathered runtime state such
116
129
  as task artifacts, decision records, recursive sessions, and observability
117
130
  signals.
118
131
 
132
+ For agent-facing examples and prompt patterns that encourage actual runtime
133
+ usage instead of passive installation, see `docs/agent-usage-playbook.md`.
134
+
119
135
  ## Maintainer source-checkout examples
120
136
 
121
137
  When developing Harness Forge itself from a source checkout, the equivalent
@@ -37,6 +37,7 @@
37
37
  "version": 1,
38
38
  "description": "Core command guidance and usage patterns.",
39
39
  "paths": [
40
+ "commands/hforge-analyze.md",
40
41
  "commands/plan.md",
41
42
  "commands/test.md",
42
43
  "contexts/dev.md",
@@ -59,7 +60,7 @@
59
60
  ],
60
61
  "owner": "core",
61
62
  "usageCues": [
62
- "Use when starting, testing, or validating work."
63
+ "Use when starting, testing, validating, or analyzing work."
63
64
  ]
64
65
  },
65
66
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-03-28T21:42:25.027Z",
2
+ "generatedAt": "2026-03-28T22:25:09.358Z",
3
3
  "entries": [
4
4
  {
5
5
  "subjectType": "language",
@@ -64,6 +64,9 @@
64
64
  "docs/observability.md",
65
65
  "docs/benchmark-scenarios.md",
66
66
  "docs/release-process.md",
67
+ "commands/hforge-analyze.md",
68
+ "commands/plan.md",
69
+ "commands/test.md",
67
70
  "knowledge-bases/seeded/README.md",
68
71
  "rules/common/README.md",
69
72
  "skills/README.md",
@@ -222,6 +225,9 @@
222
225
  "docs/benchmark-scenarios.md",
223
226
  "docs/troubleshooting.md",
224
227
  "docs/versioning-and-migration.md",
228
+ "commands/hforge-analyze.md",
229
+ "commands/plan.md",
230
+ "commands/test.md",
225
231
  "hooks",
226
232
  "mcp",
227
233
  "profiles"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harness-forge/cli",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Harness Forge: modular agentic AI workspace installer, catalog, and workflow runtime.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,6 +4,9 @@ import { fileURLToPath } from "node:url";
4
4
 
5
5
  const IGNORED_DIRS = new Set([
6
6
  ".git",
7
+ ".claude",
8
+ ".codex",
9
+ ".cursor",
7
10
  ".hforge",
8
11
  ".next",
9
12
  ".nuxt",
@@ -19,9 +22,47 @@ const IGNORED_DIRS = new Set([
19
22
 
20
23
  const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
21
24
 
22
- function bump(map, key, evidence) {
25
+ function languageWeightForPath(file) {
26
+ const normalized = file.replaceAll("\\", "/");
27
+
28
+ if (
29
+ normalized.startsWith(".claude/") ||
30
+ normalized.startsWith(".codex/") ||
31
+ normalized.startsWith(".cursor/") ||
32
+ normalized.startsWith(".agents/") ||
33
+ normalized.startsWith(".github/")
34
+ ) {
35
+ return 0;
36
+ }
37
+
38
+ if (
39
+ normalized.startsWith("src/") ||
40
+ normalized.startsWith("app/") ||
41
+ normalized.startsWith("lib/") ||
42
+ normalized.startsWith("seed/") ||
43
+ normalized.startsWith("data/")
44
+ ) {
45
+ return 2;
46
+ }
47
+
48
+ if (
49
+ normalized.startsWith("scripts/") ||
50
+ normalized.startsWith("tools/") ||
51
+ normalized.startsWith("bin/")
52
+ ) {
53
+ return 0.35;
54
+ }
55
+
56
+ if (normalized.startsWith("tests/") || normalized.includes("/tests/")) {
57
+ return 0.5;
58
+ }
59
+
60
+ return 1;
61
+ }
62
+
63
+ function bump(map, key, evidence, amount = 1) {
23
64
  const current = map.get(key) ?? { count: 0, evidence: [] };
24
- current.count += 1;
65
+ current.count += amount;
25
66
  if (evidence && current.evidence.length < 5 && !current.evidence.includes(evidence)) {
26
67
  current.evidence.push(evidence);
27
68
  }
@@ -105,41 +146,49 @@ function detectLanguages(files) {
105
146
  const languageCounts = new Map();
106
147
 
107
148
  for (const file of files) {
149
+ const weight = languageWeightForPath(file);
150
+ if (weight <= 0) {
151
+ continue;
152
+ }
153
+
108
154
  if (/\.(ts|tsx|js|jsx)$/i.test(file)) {
109
- bump(languageCounts, "typescript", file);
155
+ bump(languageCounts, "typescript", file, weight);
110
156
  }
111
157
  if (/\.py$/i.test(file)) {
112
- bump(languageCounts, "python", file);
158
+ bump(languageCounts, "python", file, weight);
113
159
  }
114
160
  if (/\.go$/i.test(file)) {
115
- bump(languageCounts, "go", file);
161
+ bump(languageCounts, "go", file, weight);
116
162
  }
117
163
  if (/\.java$/i.test(file)) {
118
- bump(languageCounts, "java", file);
164
+ bump(languageCounts, "java", file, weight);
119
165
  }
120
166
  if (/\.(kt|kts)$/i.test(file)) {
121
- bump(languageCounts, "kotlin", file);
167
+ bump(languageCounts, "kotlin", file, weight);
122
168
  }
123
169
  if (/\.rs$/i.test(file)) {
124
- bump(languageCounts, "rust", file);
170
+ bump(languageCounts, "rust", file, weight);
125
171
  }
126
172
  if (/\.(cpp|cxx|cc|hpp|hh|h)$/i.test(file)) {
127
- bump(languageCounts, "cpp", file);
173
+ bump(languageCounts, "cpp", file, weight);
128
174
  }
129
175
  if (/\.php$/i.test(file)) {
130
- bump(languageCounts, "php", file);
176
+ bump(languageCounts, "php", file, weight);
131
177
  }
132
178
  if (/\.(pl|pm)$/i.test(file)) {
133
- bump(languageCounts, "perl", file);
179
+ bump(languageCounts, "perl", file, weight);
134
180
  }
135
181
  if (/\.swift$/i.test(file)) {
136
- bump(languageCounts, "swift", file);
182
+ bump(languageCounts, "swift", file, weight);
183
+ }
184
+ if (/\.lua$/i.test(file)) {
185
+ bump(languageCounts, "lua", file, weight);
137
186
  }
138
187
  if (/\.(sh|bash|zsh)$/i.test(file)) {
139
- bump(languageCounts, "shell", file);
188
+ bump(languageCounts, "shell", file, weight);
140
189
  }
141
190
  if (/\.(cs|csproj|sln)$/i.test(file)) {
142
- bump(languageCounts, "dotnet", file);
191
+ bump(languageCounts, "dotnet", file, weight);
143
192
  }
144
193
  }
145
194