@harnessforce/claude-code-plugin 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +34 -13
- package/commands/help.md +31 -0
- package/commands/import.md +18 -0
- package/commands/run.md +25 -0
- package/commands/setup.md +29 -47
- package/commands/status.md +26 -0
- package/commands/tune.md +18 -18
- package/package.json +1 -1
- package/scripts/harnessforce-hook-main.cjs +539 -154
- package/scripts/harnessforce-hook.cjs +2 -1
- package/skills/propose-improvements/SKILL.md +69 -69
- package/skills/propose-improvements/scripts/summarize.mjs +59 -57
- package/skills/record-run/SKILL.md +14 -51
- package/skills/using-harnessforce/SKILL.md +32 -32
package/README.md
CHANGED
|
@@ -12,11 +12,15 @@ and does not bundle the CLI (`/harnessforce:setup` installs `@harnessforce/cli`
|
|
|
12
12
|
| --- | --- |
|
|
13
13
|
| `SessionStart` and `UserPromptSubmit` hooks | Register each session and its config snapshot with Harnessforce |
|
|
14
14
|
| `PostToolUse`, `PostToolUseFailure`, `UserPromptExpansion`, `PermissionRequest`, `PostCompact` and `SessionEnd` hooks | Count the configured skills, commands, subagents and MCP servers a session uses, and send the session usage summary |
|
|
15
|
-
| MCP server `harnessforce` (`<connection URL>/mcp`, HTTP) | Tools to start a run, read an Issue, and
|
|
15
|
+
| MCP server `harnessforce` (`<connection URL>/mcp`, HTTP) | Tools to start a run, read an Issue, and complete a run |
|
|
16
16
|
| Skill `using-harnessforce` | What Harnessforce records and does not collect, which hook sends what, and when to use the other skills. The `SessionStart` hook injects its body into the context of every session (the build embeds the same text into the hook and the CLI) |
|
|
17
|
-
| Skill `record-run` | Tells the agent when to
|
|
18
|
-
| Command `/harnessforce:setup` | Checks Node.js, installs the `harnessforce` CLI, asks whether to send content, runs `harnessforce init` (`--send-content` when chosen) and `harnessforce import`,
|
|
17
|
+
| Skill `record-run` | Tells the agent when to start and complete a run |
|
|
18
|
+
| Command `/harnessforce:setup` | Checks Node.js, installs the `harnessforce` CLI, asks whether to send content, runs `harnessforce init` (`--send-content` when chosen) and `harnessforce import`, and confirms the first event after a restart |
|
|
19
19
|
| Command `/harnessforce:tune` | Tells you that the agent reads parts of your transcripts through your model provider, runs `harnessforce tune --json`, shows the analysis and the before and after of earlier applied proposals, and makes proposals for the targets with enough data |
|
|
20
|
+
| Command `/harnessforce:status` | Runs `harnessforce top --once --json` and summarizes the sessions on this machine. Read-only |
|
|
21
|
+
| Command `/harnessforce:import` | Runs `harnessforce import` and shows the imported count and why sessions were skipped |
|
|
22
|
+
| Command `/harnessforce:run <issue>` | Shows how to start an agent on an Issue with `harnessforce run --issue <issue> -- <agent>` in a terminal, and how `HARNESSFORCE_ISSUE` ties a session to an Issue. Runs nothing |
|
|
23
|
+
| Command `/harnessforce:help` | Lists the CLI commands (`harnessforce --help`) and these commands, and says which ones are not wrapped (`init`, the interactive `top`) |
|
|
20
24
|
| Skill `propose-improvements` | How the agent writes a proposal (evidence, diff or pull request draft, expected effect, how to measure), keeps permissions minimal and loops bounded, and records it with `harnessforce tune record` before showing it |
|
|
21
25
|
|
|
22
26
|
The hooks and the MCP server exist only in the build output, because their scripts and connection URL
|
|
@@ -25,7 +29,8 @@ come from the build. The copy of the plugin in this repository has no hooks and
|
|
|
25
29
|
|
|
26
30
|
## Install
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
The marketplace installs the plugin from npm, with no version pinned, so you get the latest
|
|
33
|
+
published version:
|
|
29
34
|
|
|
30
35
|
```text
|
|
31
36
|
/plugin marketplace add lambda-script/harnessforce-agent
|
|
@@ -33,7 +38,8 @@ Public distribution starts once the production domain of Harnessforce is decided
|
|
|
33
38
|
/harnessforce:setup
|
|
34
39
|
```
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
To connect to a staging or local `apps/web` instead, install the
|
|
42
|
+
[local marketplace build](../../docs/runbooks/local-marketplace.md).
|
|
37
43
|
|
|
38
44
|
## Requirements
|
|
39
45
|
|
|
@@ -44,9 +50,22 @@ continues without sending anything.
|
|
|
44
50
|
|
|
45
51
|
When a hook cannot send, it shows one line in the session instead of staying silent: Node.js older than 18,
|
|
46
52
|
a failed restart of the hook process, sending not set up (`/harnessforce:setup`), an endpoint that is set
|
|
47
|
-
but not allowed,
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
but not allowed, no ingest key in the keychain (for example after a reboot cleared the kernel keyring), a
|
|
54
|
+
destination that differs from the one `harnessforce init` saved, the Claude Code telemetry settings that
|
|
55
|
+
`harnessforce init` wrote missing from the user settings, a keychain that could not be read, and a session
|
|
56
|
+
registration that failed with anything other than 401. The line appears only at a session start that
|
|
57
|
+
registers (`startup`, `clear`, `fork`), except for the two startup failures, which appear at every session
|
|
58
|
+
start. Nothing is shown while sending works, and nothing is checked again later in the session. When
|
|
59
|
+
`harnessforce` is not on `PATH`, the hook shows nothing: Claude Code reports that `otelHeadersHelper` failed.
|
|
60
|
+
|
|
61
|
+
## Updates
|
|
62
|
+
|
|
63
|
+
The hooks send `User-Agent: harnessforce-claude-code-plugin/<version>` and keep the update status the
|
|
64
|
+
server returns in `${CLAUDE_PLUGIN_DATA}/update-status.json`. When a session starts they show one line
|
|
65
|
+
for a newer version (once a day, and not while Claude Code updates the plugin automatically), for the
|
|
66
|
+
date a version stops sending after a security fix, or for an unsupported version. An unsupported version
|
|
67
|
+
sends nothing until you run `claude plugin update harnessforce@harnessforce-agent`; the session keeps
|
|
68
|
+
running. `harnessforce init` turns on automatic updates for the `harnessforce-agent` marketplace.
|
|
50
69
|
|
|
51
70
|
## Session registration hooks
|
|
52
71
|
|
|
@@ -56,8 +75,8 @@ repository, branch and commit of `cwd` to `POST <HARNESSFORCE_ENDPOINT>/v1/sessi
|
|
|
56
75
|
prompt it sends the same registration again with the prompt ID. Prompts, responses and file
|
|
57
76
|
contents are never sent.
|
|
58
77
|
|
|
59
|
-
- For an organization, set `HARNESSFORCE_ENDPOINT` (the ingest base URL
|
|
60
|
-
|
|
78
|
+
- For an organization, set `HARNESSFORCE_ENDPOINT` (the ingest base URL, `https:`) and
|
|
79
|
+
`HARNESSFORCE_INGEST_KEY` (a Workspace ingest key) in
|
|
61
80
|
the `env` of the managed settings file (`managed-settings.json` or `managed-settings.d/*.json` in
|
|
62
81
|
the managed directory). The hook reads the Workspace key and its endpoint only from those files,
|
|
63
82
|
never from the process environment, because a repository's `.claude/settings.json` can set
|
|
@@ -72,8 +91,8 @@ contents are never sent.
|
|
|
72
91
|
configuration, on errors, or after 2 seconds it gives up quietly and writes the reason to stderr
|
|
73
92
|
(Claude Code's debug log). Without Node.js, Claude Code shows a non-blocking `hook error`.
|
|
74
93
|
- If the key is revoked, Claude Code shows once per session:
|
|
75
|
-
|
|
76
|
-
|
|
94
|
+
"The organization's ingest key has been revoked. Contact a Workspace administrator" (Workspace key) or
|
|
95
|
+
"Your ingest key has been revoked. Run `harnessforce init`" (user key)
|
|
77
96
|
|
|
78
97
|
## Config snapshot
|
|
79
98
|
|
|
@@ -89,7 +108,9 @@ an identifier, plus a SHA-256 hash:
|
|
|
89
108
|
- The same kinds of component from enabled marketplace plugins in the plugin cache.
|
|
90
109
|
|
|
91
110
|
File contents, settings values and MCP server configuration (URLs, headers, environment) are never
|
|
92
|
-
sent, only their hashes.
|
|
111
|
+
sent, only their hashes. The hashes of hooks and MCP servers leave out the values that can carry
|
|
112
|
+
credentials: `env` and `headers` values, `args`, and the userinfo, query and fragment of URLs, so a
|
|
113
|
+
hash cannot be brute-forced back to a short secret. Nothing is sent when there are no components, and the snapshot is skipped
|
|
93
114
|
when collection takes over 1 second or finds more than 1,000 components. The collector lives in
|
|
94
115
|
`packages/agent-core/src/config`, shared with `harnessforce run` so it can compute the same snapshot ID.
|
|
95
116
|
|
package/commands/help.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: List the harnessforce CLI commands and the /harnessforce:* commands, and say which one to use for what
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Harnessforce help
|
|
7
|
+
|
|
8
|
+
Show the user this guide. To list the CLI commands with a one-line description each, run:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
harnessforce --help
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
If the command is not found, tell the user to run `/harnessforce:setup`. `harnessforce <command> --help` shows what a command does, what it sends and does not send, and its exit codes.
|
|
15
|
+
|
|
16
|
+
## Commands in a session
|
|
17
|
+
|
|
18
|
+
| Command | What it does |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `/harnessforce:setup` | Installs the CLI, connects to Harnessforce with `harnessforce init`, imports past sessions and confirms the first event. |
|
|
21
|
+
| `/harnessforce:status` | Summarizes the sessions on this machine (read-only). |
|
|
22
|
+
| `/harnessforce:import` | Imports past sessions. |
|
|
23
|
+
| `/harnessforce:tune` | Analyzes your past sessions and proposes improvements. |
|
|
24
|
+
| `/harnessforce:run <issue>` | Shows how to start an agent on an Issue. |
|
|
25
|
+
|
|
26
|
+
## Not wrapped
|
|
27
|
+
|
|
28
|
+
- `harnessforce init` opens a browser to log in and takes up to 5 minutes, so it is not wrapped as its own command. `/harnessforce:setup` runs it for you.
|
|
29
|
+
- `harnessforce top` without `--once` is an interactive view that needs a terminal. Run it in a terminal.
|
|
30
|
+
- `harnessforce run` starts an agent as a new process. See `/harnessforce:run`.
|
|
31
|
+
- `harnessforce otel-headers` and `harnessforce hook` are run by the agents, not by you.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Import your past sessions on this machine into Harnessforce and report how many were imported and why others were skipped
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Import past sessions
|
|
7
|
+
|
|
8
|
+
`harnessforce import` sends a summary of each past session of the repositories connected to your Workspace, inside the import window. It sends no prompt text, responses, tool inputs or results, or code. It is safe to run again, because sessions that were already sent are skipped.
|
|
9
|
+
|
|
10
|
+
Run it:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
harnessforce import
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- If the command is not found, tell the user to run `/harnessforce:setup` and stop.
|
|
17
|
+
- If it reports that you are not logged in, tell the user to run `/harnessforce:setup` (it runs `harnessforce init`, which needs a browser) and stop.
|
|
18
|
+
- Show the imported count and the breakdown of skipped sessions with the next action, exactly as printed. Do not leave out the reason when nothing was imported.
|
package/commands/run.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Explain how to start an agent on a Harnessforce Issue with harnessforce run, because a session cannot start its own agent
|
|
3
|
+
argument-hint: "<issue-identifier>"
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Run an agent on an Issue
|
|
8
|
+
|
|
9
|
+
`harnessforce run` starts an agent for an Issue. It has to start that agent as a new process in a terminal, so this command cannot do it from inside a session. It runs nothing. It only shows the steps.
|
|
10
|
+
|
|
11
|
+
Take the Issue identifier from `$ARGUMENTS` (for example `ABC-123`). If it is empty, ask the user for it.
|
|
12
|
+
|
|
13
|
+
## Start the agent in a terminal
|
|
14
|
+
|
|
15
|
+
Tell the user to run this in a terminal, outside this session. Replace `claude` with the agent to start (for example `codex`).
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
harnessforce run --issue <identifier> -- claude
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Everything after `--` is passed to the agent unchanged. The agent's exit code becomes the exit code of `harnessforce run`. It needs `harnessforce init` to have been done; if not, run `/harnessforce:setup` first.
|
|
22
|
+
|
|
23
|
+
## Already in a session?
|
|
24
|
+
|
|
25
|
+
The plugin's hooks tie a session to an Issue when the environment variable `HARNESSFORCE_ISSUE` is set to the identifier before the agent starts. `harnessforce run` sets it for you. This session was started without it unless the user set it, and an environment variable cannot be added to a running session. To work on the Issue, start a new session as above.
|
package/commands/setup.md
CHANGED
|
@@ -1,83 +1,65 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Harnessforce
|
|
2
|
+
description: Harnessforce setup. Walks through checking Node.js, choosing whether to send prompt content, installing the CLI, running harnessforce init, importing past sessions, and confirming the first event after the restart
|
|
3
3
|
disable-model-invocation: true
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Harnessforce
|
|
6
|
+
# Harnessforce setup
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Go through the steps below in order, interacting with the user. If a command fails, show its output to the user and stop without moving on to the later steps.
|
|
9
9
|
|
|
10
|
-
## 1. Node.js
|
|
10
|
+
## 1. Check Node.js
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
First run `node --version`. If the command is not found, or the version is below 18, do not move on to installing the CLI. Show the following text as it is and stop.
|
|
13
13
|
|
|
14
|
-
>
|
|
14
|
+
> Harnessforce hooks require Node.js 18 or later. Install Node.js, restart Claude Code, then run `/harnessforce:setup` again.
|
|
15
15
|
|
|
16
|
-
## 2.
|
|
16
|
+
## 2. Check whether this run is after the restart
|
|
17
17
|
|
|
18
|
-
`harnessforce --version
|
|
18
|
+
If `harnessforce --version` succeeds and the environment variable `HARNESSFORCE_WORKSPACE_ID` of this session is not empty, this is a session restarted after `harnessforce init`. Skip steps 3 to 7 and go to step 8.
|
|
19
19
|
|
|
20
|
-
## 3. CLI
|
|
20
|
+
## 3. Install the CLI
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Run the following, then confirm the install with `harnessforce --version`.
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
25
|
npm install -g @harnessforce/cli
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
## 4.
|
|
28
|
+
## 4. Choose whether to send prompt content
|
|
29
29
|
|
|
30
|
-
`harnessforce init
|
|
30
|
+
Before `harnessforce init`, present the option to send prompt content to the user, not selected by default. The login is not done yet at this point, so neither the Workspace to connect nor its opt-in state is known. Do not change what you show depending on the opt-in.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Present the option together with the following.
|
|
33
33
|
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
34
|
+
- If selected, the body of the prompts the user types to the agent is delivered to this Workspace. Secret patterns, email addresses, and phone numbers are replaced with `[REDACTED:kind]` before storing, and the content is deleted after the content retention period (at most 30 days). Secrets and personal information that do not match a pattern are not masked, and not everything can be detected. Within the Workspace, only the person who sent the stored content can read it; Owners and Admins cannot read it either. That person can delete their own content at any time from My practices.
|
|
35
|
+
- Content is stored only when both this setting on the device and the Workspace opt-in are in place. If the Workspace opt-in is withdrawn, later content is discarded on receipt and existing content data can no longer be read. This setting does not enable sending model responses or tool input and output.
|
|
36
|
+
- If selected, run `harnessforce init --send-content`; if not, run `harnessforce init` (step 5). Write this setting to the `env` of the Claude Code user settings, and do not write it to the `env` of the project (`.claude/settings.json`) or local (`.claude/settings.local.json`) files, because the content variable is ignored in the `env` of those two files.
|
|
37
|
+
- To stop after selecting it, set `OTEL_LOG_USER_PROMPTS` in the `env` of the user settings to `0`. The value that stops it also takes effect in the project and local `env`.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Use the following option text as it is.
|
|
40
40
|
|
|
41
|
-
> 入力した指示の本文を送って分析に使えます(既定では無効。Workspaceが指示本文をオプトインしている場合だけ有効になります)。有効にすると、エージェントに入力した指示の本文がこのWorkspaceへ届き、保存されます。パターンに一致した秘密値と個人情報は`[REDACTED:種類]`に置き換えますが、すべてを検出できるとは限りません。本文データの保持期間(最大30日)で削除し、Workspaceのメンバーの中では、読めるのは送ったあなただけです。自分のやり方の画面からいつでも削除できます。有効にしますか?
|
|
42
|
-
>
|
|
43
41
|
> You can send the prompts you type for analysis (off by default; it takes effect only if the workspace has opted in to prompts you typed). If enabled, the prompts you type to the agent are delivered to this workspace and stored. Values that match known patterns for secrets and personal information are replaced with `[REDACTED:kind]`, but not everything can be detected. Content is deleted after the content retention period (at most 30 days), and within the workspace only you can read it. You can delete it at any time from My practices. Enable this?
|
|
44
42
|
>
|
|
45
|
-
> 本文を送りません(既定)。後から設定できます
|
|
46
|
-
>
|
|
47
43
|
> Content is not sent (by default). You can enable it later.
|
|
48
44
|
|
|
49
|
-
## 5. Harnessforce
|
|
50
|
-
|
|
51
|
-
手順4の選択に従い、選んだ場合は`harnessforce init --send-content`、選ばない場合は`harnessforce init`を実行する。ブラウザでHarnessforceにログインし、接続するWorkspaceを1つ選ぶよう利用者へ伝える。ブラウザが開かなければ、`harnessforce init`が表示するURLを利用者へ示す。ログインの完了を最大5分待つため、Bashのtimeoutを10分にして実行する。
|
|
52
|
-
|
|
53
|
-
opt-inしていないWorkspaceでは`harnessforce init --send-content`は本文の設定を書かず、その旨とWorkspaceの設定のデータの保持への案内を表示して終了コード0で終わる。失敗として扱わず、表示された文言をそのまま利用者へ示す。
|
|
54
|
-
|
|
55
|
-
## 6. 過去のsessionを取り込む
|
|
45
|
+
## 5. Connect to Harnessforce
|
|
56
46
|
|
|
57
|
-
`harnessforce
|
|
47
|
+
Follow the choice in step 4: run `harnessforce init --send-content` if selected, or `harnessforce init` if not. Tell the user to log in to Harnessforce in the browser and choose one Workspace to connect. If the browser does not open, show the user the URL that `harnessforce init` prints. The command waits up to 5 minutes for the login to complete, so run it with a Bash timeout of 10 minutes.
|
|
58
48
|
|
|
59
|
-
|
|
49
|
+
For a Workspace that has not opted in, `harnessforce init --send-content` does not write the content setting. It prints a message about that and about the Data retention page of the Workspace settings, and exits with code 0. Do not treat this as a failure; show the printed text to the user as it is.
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
## 6. Import past sessions
|
|
62
52
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
> 利用枠を共有できます(既定では共有しません)。共有すると、あなたの名前とともに、あなたの利用枠(5時間・7日などの窓の使用率とリセット時刻だけ)を、このWorkspaceのメンバー全員が見られます。プロンプトなどの本文は送りません。いつでもやめられ、やめると保存済みの値も削除します。メンバーの順位づけには使いません。共有しますか?
|
|
66
|
-
>
|
|
67
|
-
> You can share your usage limits (not shared by default). If shared, everyone in this workspace can see your usage limits together with your name (only the usage percentage and reset time of each window, such as 5 hours and 7 days). No prompt or other content is sent. You can stop at any time, and stopping deletes the stored values. They are not used to rank members. Share them?
|
|
68
|
-
>
|
|
69
|
-
> 共有しません(既定)。後から`harnessforce usage-limits on`で設定できます
|
|
70
|
-
>
|
|
71
|
-
> Not shared (by default). You can set it up later with `harnessforce usage-limits on`.
|
|
53
|
+
Run `harnessforce import` and tell the user, as it is, the imported count it prints, along with the breakdown of sessions that were not imported and the guidance. Do not omit the printed reason and the next action even when the count is 0.
|
|
72
54
|
|
|
73
|
-
|
|
55
|
+
## 7. Ask for a restart
|
|
74
56
|
|
|
75
|
-
|
|
57
|
+
Tell the user the following and stop.
|
|
76
58
|
|
|
77
|
-
|
|
59
|
+
> Harnessforce setup, part 1 of 2, is done. Restart Claude Code, then run `/harnessforce:setup` again in the new session. Part 2 checks that the first event arrived.
|
|
78
60
|
|
|
79
|
-
|
|
61
|
+
## 8. Confirm the first event
|
|
80
62
|
|
|
81
|
-
|
|
63
|
+
At the start of this session, the plugin hook sent the session to Harnessforce. Tell the user to open the Harnessforce Home in the browser (the URL in the environment variable `HARNESSFORCE_URL`) and confirm on the waiting screen for the first Run that it was received. If nothing arrives after 15 minutes, tell the user to follow the checks for each cause shown on the waiting screen. Finish with the following line.
|
|
82
64
|
|
|
83
|
-
|
|
65
|
+
> Harnessforce setup is complete.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Show the running and recent agent sessions on this machine as a short summary, using a read-only snapshot of harnessforce top
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Session status
|
|
7
|
+
|
|
8
|
+
This command only reads. It changes no file, setting or Workspace data, and sends nothing to Harnessforce.
|
|
9
|
+
|
|
10
|
+
## 1. Take a snapshot
|
|
11
|
+
|
|
12
|
+
Run this once. It prints one snapshot as JSON and exits, so it does not open the interactive view.
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
harnessforce top --once --json
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If the command is not found, tell the user to run `/harnessforce:setup` and stop. If it fails, show its output as is and stop.
|
|
19
|
+
|
|
20
|
+
## 2. Summarize
|
|
21
|
+
|
|
22
|
+
Summarize the snapshot for the user in a few lines: how many sessions are running, which agent and repository each belongs to, and any recent sessions that ended. Report only values that are in the JSON. Do not guess a value that is missing, and do not turn a missing value into 0.
|
|
23
|
+
|
|
24
|
+
## 3. Point to the live view
|
|
25
|
+
|
|
26
|
+
The interactive view needs a terminal, so this command does not start it. Tell the user to run `harnessforce top` in a terminal when they want the live view.
|
package/commands/tune.md
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Analyze your past sessions and show the analysis results, the before and after of the previous suggestion, and suggested improvements for human interventions, repeatable loops, MCP servers, and usage. Does not modify files
|
|
3
3
|
argument-hint: "[--all] [--no-send]"
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Analyze past sessions and suggest improvements
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Go through the steps below in order. This run does not modify the user's files, settings, repository, or managed settings. The only things written are what `harnessforce tune` and `harnessforce tune record` write to `~/.harnessforce/tune/`.
|
|
10
10
|
|
|
11
|
-
## 1. model
|
|
11
|
+
## 1. Say that content goes to the model provider
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Before running anything, show the following text as it is.
|
|
14
14
|
|
|
15
|
-
>
|
|
15
|
+
> To make suggestions, the agent reads part of the session records on this device in this run. What it reads goes to the provider of the model you normally use with this agent, through the same path as a normal session. It does not go to Harnessforce. Harnessforce receives only the analysis result values counted by the public rules.
|
|
16
16
|
|
|
17
|
-
## 2.
|
|
17
|
+
## 2. Analyze
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Run the following. It starts `harnessforce tune --json` and shows the analysis results and, for each target, the result of checking the conditions for making a suggestion. It includes sending and resending unsent results, so set the Bash timeout to 10 minutes.
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
22
|
node "${CLAUDE_PLUGIN_ROOT}/skills/propose-improvements/scripts/summarize.mjs" $ARGUMENTS
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
- stderr
|
|
26
|
-
- stdout
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
25
|
+
- The lines on stderr are the messages of `harnessforce tune`. Show all of them as they are, without omitting or rephrasing them.
|
|
26
|
+
- Show the analysis results on stdout (human interventions, repeatable loops, MCP servers, usage) as they are. Do not rephrase "not measured" as 0. Usage values stay on this device and are not sent to Harnessforce.
|
|
27
|
+
- If there is a "Before and after the previous suggestion" section, show it as it is before the new suggestions, and do not omit "Before/after difference (does not show causation)" or "The starting point is the time the application was detected". Do not rephrase "No comparison data" as a difference of 0.
|
|
28
|
+
- If the exit code is anything other than 0 or 3, finish without making suggestions. The same applies when the message says `harnessforce` was not found.
|
|
29
|
+
- If there is a "Not enough data, so no suggestions are made" line, show that line and finish without making suggestions.
|
|
30
30
|
|
|
31
|
-
## 3.
|
|
31
|
+
## 3. Make suggestions
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Show all the "Targets for suggestions" lines. Show the "Not enough data" and "not measured, so no suggestion is made" lines as they are, including what is still needed, and make no suggestion for those targets.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
For the targets marked "a suggestion can be made", make suggestions by following the `propose-improvements` skill of this plugin, record them with `harnessforce tune record`, and then show them. Do not show a suggestion whose recording did not end with exit code 0.
|
|
36
36
|
|
|
37
|
-
## 4.
|
|
37
|
+
## 4. Explain how to apply
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Finally, tell the user that applying the suggestions is up to the user. They apply them by editing by hand, running `git apply`, or telling the agent in their own session to apply them. This command does not apply them. A suggestion that was applied is detected in the next run of `/harnessforce:tune`, and only counts are sent to Harnessforce.
|