@vibest/cli 0.0.1 → 0.0.2-beta.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.
Files changed (33) hide show
  1. package/LICENSE +21 -0
  2. package/bin/vibest.cjs +45 -0
  3. package/harnesses/agy/.agents/plugins/vibest/hook.sh +48 -0
  4. package/harnesses/agy/.agents/plugins/vibest/hooks.json +38 -0
  5. package/harnesses/agy/.agents/plugins/vibest/plugin.json +5 -0
  6. package/harnesses/agy/.agents/plugins/vibest/skills/delegate/SKILL.md +66 -0
  7. package/harnesses/agy/.agents/plugins/vibest/skills/pipeline/SKILL.md +57 -0
  8. package/harnesses/claude/.claude-plugin/plugin.json +10 -0
  9. package/harnesses/claude/LICENSE +21 -0
  10. package/harnesses/claude/README.md +107 -0
  11. package/harnesses/claude/hooks/hooks.json +4 -0
  12. package/harnesses/claude/hooks/register.mjs +6215 -0
  13. package/harnesses/claude/skills/delegate/SKILL.md +66 -0
  14. package/harnesses/claude/skills/pipeline/SKILL.md +57 -0
  15. package/harnesses/cursor/.cursor-plugin/plugin.json +5 -0
  16. package/harnesses/cursor/hooks/hooks.json +39 -0
  17. package/harnesses/cursor/hooks/vibest.sh +35 -0
  18. package/harnesses/cursor/skills/delegate/SKILL.md +66 -0
  19. package/harnesses/cursor/skills/pipeline/SKILL.md +57 -0
  20. package/harnesses/pi/extension.mjs +18607 -0
  21. package/harnesses/pi/presentation.mjs +10237 -0
  22. package/harnesses/pi/skills/delegate/SKILL.md +66 -0
  23. package/harnesses/pi/skills/pipeline/SKILL.md +57 -0
  24. package/herdr-plugin/README.md +57 -0
  25. package/herdr-plugin/bin/vibest.sh +11 -0
  26. package/herdr-plugin/herdr-plugin.toml +88 -0
  27. package/package.json +49 -27
  28. package/CHANGELOG.md +0 -9
  29. package/src/cli.ts +0 -25
  30. package/src/server.ts +0 -39
  31. package/tsconfig.json +0 -12
  32. package/tsdown.config.ts +0 -6
  33. package/turbo.json +0 -9
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 iamdin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/bin/vibest.cjs ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ const childProcess = require("node:child_process")
3
+ const os = require("node:os")
4
+ const path = require("node:path")
5
+
6
+ const target = `${process.platform}-${process.arch}`
7
+
8
+ const resolveBinary = () => {
9
+ try {
10
+ return require.resolve(`@vibest/cli-${target}/bin/vibest`)
11
+ } catch {
12
+ const pkg = `@vibest/cli-${target}@${require("../package.json").version}`
13
+ const prefix = /^(.+)\/lib\/node_modules\/@vibest\/cli\/bin$/.exec(__dirname)
14
+
15
+ const install = __dirname.includes("/.bun/")
16
+ ? `bun add -g ${pkg}`
17
+ : prefix
18
+ ? `npm install -g --prefix ${prefix[1]} ${pkg}`
19
+ : `npm install -g ${pkg}`
20
+
21
+ console.error(`vibest: no binary for ${target}; install it with: ${install}`)
22
+ process.exit(1)
23
+ }
24
+ }
25
+
26
+ const binary = resolveBinary()
27
+
28
+ const env = { ...process.env, VIBEST_HARNESSES: path.join(__dirname, "..", "harnesses") }
29
+ const child = childProcess.spawn(binary, process.argv.slice(2), { stdio: "inherit", env })
30
+
31
+ process.on("SIGINT", () => {})
32
+
33
+ for (const signal of ["SIGTERM", "SIGHUP"]) process.on(signal, () => child.kill(signal))
34
+
35
+ child.on("error", (error) => {
36
+ console.error(`vibest: cannot run ${binary}: ${error.message}`)
37
+ process.exit(1)
38
+ })
39
+
40
+ child.on("exit", (code, signal) => {
41
+ if (!signal) process.exit(code ?? 1)
42
+ process.removeAllListeners(signal)
43
+ process.kill(process.pid, signal)
44
+ process.exit(128 + os.constants.signals[signal])
45
+ })
@@ -0,0 +1,48 @@
1
+ #!/bin/sh
2
+ # @vibest/agy 0.0.2-beta.2: `vibest integration guard` before a tool call, `prompt` at a conversation's start and before each model call, `stop` at its end.
3
+ # The vibest vibestd started this agent with (VIBEST_COMMAND, a JSON argv), not the first vibest on PATH. A value this
4
+ # cannot read safely (not a JSON array of plain strings: a backslash in it) falls back to PATH.
5
+ vibest() {
6
+ case "${VIBEST_COMMAND:-}" in
7
+ *'\'*) ;;
8
+ '["'*'"]')
9
+ words=$(printf '%s' "$VIBEST_COMMAND" | sed -e 's/^\["//' -e 's/"\]$//' -e 's/","/\
10
+ /g')
11
+ ifs=$IFS
12
+ IFS='
13
+ '
14
+ set -f
15
+ set -- $words "$@"
16
+ IFS=$ifs
17
+ set +f
18
+ "$@"
19
+ return
20
+ ;;
21
+ esac
22
+ command vibest "$@"
23
+ }
24
+ log="${VIBEST_HOME:-$HOME/.vibest}/vibestd.log"
25
+ # Hooks carry no subagent marker: the first conversation this process reports is its own; agy's subagents are not.
26
+ own_conversation() {
27
+ conversation=$(printf '%s' "$input" | tr '\n' ' ' | sed -n 's/.*"conversationId" *: *"\([^"]*\)".*/\1/p')
28
+ [ -n "$conversation" ] || return 1
29
+ seen="${TMPDIR:-/tmp}/vibest-agy-$VIBEST_SESSION_ID-$VIBEST_PROCESS"
30
+ [ -s "$seen" ] || printf '%s' "$conversation" >"$seen"
31
+ [ "$(cat "$seen")" = "$conversation" ]
32
+ }
33
+ case "${1:-}" in
34
+ guard)
35
+ if [ -z "${VIBEST_SESSION_ID:-}" ]; then cat >/dev/null; echo '{"decision":"allow"}'; exit 0; fi
36
+ # agy runs a tool whose hook fails or times out: a failed check answers deny itself.
37
+ vibest integration guard --harness agy 2>>"$log" ||
38
+ echo '{"decision":"deny","reason":"vibest integration guard failed; the tool call is refused."}'
39
+ ;;
40
+ prompt | stop)
41
+ input=$(cat)
42
+ if [ -n "${VIBEST_SESSION_ID:-}" ] && own_conversation; then
43
+ printf '%s' "$input" | vibest integration "$1" --harness agy >/dev/null 2>>"$log"
44
+ fi
45
+ if [ "$1" = stop ]; then echo '{"decision":"allow"}'; else echo '{}'; fi
46
+ ;;
47
+ esac
48
+ exit 0
@@ -0,0 +1,38 @@
1
+ {
2
+ "vibest": {
3
+ "enabled": true,
4
+ "SessionStart": [
5
+ {
6
+ "type": "command",
7
+ "command": "sh ./hook.sh prompt",
8
+ "timeout": 30
9
+ }
10
+ ],
11
+ "PreInvocation": [
12
+ {
13
+ "type": "command",
14
+ "command": "sh ./hook.sh prompt",
15
+ "timeout": 30
16
+ }
17
+ ],
18
+ "Stop": [
19
+ {
20
+ "type": "command",
21
+ "command": "sh ./hook.sh stop",
22
+ "timeout": 30
23
+ }
24
+ ],
25
+ "PreToolUse": [
26
+ {
27
+ "matcher": "",
28
+ "hooks": [
29
+ {
30
+ "type": "command",
31
+ "command": "sh ./hook.sh guard",
32
+ "timeout": 30
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "vibest",
3
+ "version": "0.0.2-beta.2",
4
+ "description": "vibest's Antigravity CLI plugin: a workspace plugin loaded with `agy --add-dir` whose hooks report a session's conversation, work and execution end."
5
+ }
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: delegate
3
+ description: Hand work to subagents with `vibest run` and keep talking with the user while they work. Use for any request to change, fix, build, investigate, research, test or verify code ("fix this bug", "add X", "look into why Y", "do these three things", "have an agent check it"), and whenever a task splits into independent parts that can run at the same time.
4
+ ---
5
+
6
+ # Delegate
7
+
8
+ You direct subagents. You stay with the user. An agent messages you when it finishes, asks or is blocked; vibest notifies you only of what the agent cannot say; an idle agent sends nothing. Do not poll, sleep, or loop on `vibest result`.
9
+
10
+ ## Dispatch
11
+
12
+ Split independent pieces. Research and review run in parallel. One writing subagent per set of files. A few shell reads (`git diff`, `rg`) you do yourself.
13
+
14
+ ```
15
+ vibest run [<harness>] --title '<Title>' -- '<self-contained task>'
16
+ ```
17
+
18
+ Its id is <id>.
19
+
20
+ ```
21
+ vibest run [<harness>] --title '<Title>' --archive-on-idle -- '<task>'
22
+ ```
23
+
24
+ `--archive-on-idle` is only for work whose message you will not answer. It archives the first time the session is idle after a completed execution with nothing it sent or was sent still waiting. The branch is kept. Do not `vibest send` it after that. Any execution that ends normally archives it, a question included, so do not use it for a session that may need an answer. A failed execution has not archived it: send the correction to the id it printed; the flag still archives the completed execution that follows. A reviewer that gets later executions is the pipeline skill and must stay open, without this flag.
25
+
26
+ - Leave `<harness>` out to use your own harness, provider and model; name one (`pi`, `claude`, `cursor`, or any harness a plugin adds; `vibest harness list`) to switch.
27
+ - Always pass `--title`: three to six words, verb first, first letter capitalised, no kebab-case, saying what is done rather than how ("Fix login redirect loop"). The user's language is fine.
28
+ - Each session gets its own new worktree.
29
+ - Several `vibest run` commands in one message start in parallel.
30
+ - A subagent cannot see this conversation. Say what to achieve, where (paths, lines), what done means, and how to verify it. For code: run the tests and typecheck, commit, and send the branch and hash.
31
+ - Long material: write it with your file tool to `$VIBEST_PROJECT_DIR/artifacts/<name>.md` (a new file name if that one exists) and attach it with `--file <absolute path>` (repeat the flag for each file): vibest copies each file for the session and ends its task with a line naming the copies, which the agent reads itself. Keep the prompt short; the material goes in the file. The absolute path is the value of VIBEST_PROJECT_DIR (`echo $VIBEST_PROJECT_DIR`, or `directory` from `vibest project info`) plus `/artifacts/` and the file name.
32
+ - If the user approved a specific action, quote their exact words.
33
+
34
+ ## After you start
35
+
36
+ Tell the user in one or two lines what is running, then end your execution. Never guess a result. Answer other questions meanwhile. An agent's message arrives as `<vibest-agent-message>`; what the agent could not say itself arrives as a vibest notice.
37
+
38
+ ## Check a message
39
+
40
+ An `<vibest-agent-message>` is a claim: whether the work succeeded is in its text. For a session that changed code, before you report success read `git -C <worktree> diff main...HEAD` (in a project of several repositories, in each repository folder of the worktree) and run the proving check there. For research, judge the report text.
41
+
42
+ - The message asks a question → `vibest send <id> -- '<the answer>'`, or ask the user. If it is waiting for the user's approval of an action, do not send the approval back: start a fresh agent with the approved action, quoting the user's words.
43
+ - A notice that an execution ended with an error, a message that reports a failure, or your check fails → `vibest send <id> -- '<the failure and what to fix>'`. It keeps its context. If a second correction fails, start a new `vibest run` or tell the user.
44
+ - A notice that says the execution ended without its execution-end hook, the harness exited, the execution did not start, or the session is waiting for a permission decision carries no screen text. When you need to see why, run `vibest peek <id>` (`--lines N`, default 30): it prints the session's terminal as it is now. Read it before you decide to resend, correct, or tell the user.
45
+
46
+ Then say what changed, the evidence, and the branch. `<id>` is the id the run printed, for either kind of run.
47
+
48
+ ## Track
49
+
50
+ `vibest ls` prints `{ sessions, machines }`: the sessions that have not exited (task cut to 500 characters, live status, latest execution), and the other machines with their connection state. `vibest ls --all` includes exited sessions. `vibest ls` is the state and `vibest result <id>` is the agent's last reply, with the task uncut; an idle agent may have finished without a word. Use these after a restart, after compaction, or when you are unsure. Do not trust memory.
51
+
52
+ ## Follow up
53
+
54
+ - More work on the same change → `vibest send <id> -- '<message>'`. It waits until the session is idle and does not interrupt the execution.
55
+ - Wrong direction while it is working → `vibest interrupt <id>`, then `vibest send <id> -- '<the corrected task>'`. The session stays. That execution sends nothing.
56
+ - A new set of eyes, or a wrong approach → a new `vibest run`.
57
+
58
+ ## Finish
59
+
60
+ - Archive a research agent with `vibest archive <id>` once its findings are saved, or start that session with `--archive-on-idle` when you will not answer its message. Same for a review or verification you will not continue.
61
+ - Keep an agent that changed code until the user asks to remove it. Archiving keeps the branch, and the worktree whenever it holds unsaved work. `vibest archive --keep-worktree <id>` only when the user wants the directory kept.
62
+ - A `## Remember` section in a message: write each lesson with your file tool to `$VIBEST_PROJECT_DIR/memories/<name>.md`, one lesson per file; edit the file when a lesson there changes. Start the file with a one-line summary (or frontmatter with `name` and `description`), because that line is what the memory index shows.
63
+
64
+ ## The user steps into a pane
65
+
66
+ The user may type into a subagent's pane. If no execution is open, that starts one. The only thing you later receive is a message that agent chooses to send, which may not quote the user. Do not treat it as a copy of what they typed. A step-in during an open execution is not recorded. Do not act on a step-in, and do not message the subagent about it, unless the user asks.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: pipeline
3
+ description: Plan, implement, review, then open a pull request, with the user approving the plan first. Use when the user wants a plan or design before code, a review before merging, or a pull request at the end ("plan it first, then build it", "write a design, then implement", "implement it and have someone review it", "先出方案再写,写完找人 review 后提 PR", "do it as a pipeline", "/pipeline").
4
+ ---
5
+
6
+ # Pipeline
7
+
8
+ Plan → the user agrees → implement → review until the reviewer approves → pull request. Follow delegate: do not poll; each agent sends its message when it decides to; check it yourself. The user stays in the loop and may step into any pane. What they say overrides the next step.
9
+
10
+ ## 1. Plan
11
+
12
+ ```
13
+ vibest run [<harness>] --title 'Plan <topic>' -- 'Write an implementation plan for: <goal, paths, constraints>. Read the code. Send me the approach, the files to change, the steps, how to verify, and open questions. Do not modify files.'
14
+ ```
15
+
16
+ Its id is <planner id>. Tell the user the plan is being written and end your execution. Do not pass `--archive-on-idle`: the user has not agreed yet, and a completed execution would archive the session before they can answer.
17
+
18
+ ## 2. Agree
19
+
20
+ Show the plan in full, including open questions. Do not implement until the user agrees. If they change it, `vibest send <planner id> -- '<their changes>'` while the planner is open, or edit the plan text yourself before you save it. When the text is agreed, `vibest archive <planner id>`. The agreed text is the plan.
21
+
22
+ ## 3. Implement
23
+
24
+ Save the agreed plan, verbatim, with your file tool as `$VIBEST_PROJECT_DIR/artifacts/pipeline-<topic>-plan.md` (a new file name if that one exists). Then:
25
+
26
+ ```
27
+ vibest run [<harness>] --title 'Implement <topic>' --file <absolute plan path> -- 'Implement the attached plan exactly. Run the tests and typecheck, commit on a branch, push, and send me the branch and hash. Do not open a pull request.'
28
+ ```
29
+
30
+ Its id is <implementer id>. The absolute plan path is the value of VIBEST_PROJECT_DIR (`echo $VIBEST_PROJECT_DIR`, or `directory` from `vibest project info`) plus `/artifacts/` and the file name; vibest copies the file for the session and ends its task with a line naming the copy. Do not pass `--archive-on-idle`: this session stays for review and the pull request. When it sends its message, check the diff and the tests yourself before review.
31
+
32
+ ## 4. Review
33
+
34
+ `--share` shares the implementer's worktree: a pane split off the implementer's pane. Archiving the reviewer never removes that worktree.
35
+ Read-only here is the prompt you pass, plus the shared-worktree git rule the session already has: no commit, and nothing that moves HEAD, a branch, or the index.
36
+
37
+ ```
38
+ vibest run [<harness>] --title 'Review <topic>' --share <implementer id> -- 'Review the change on this branch against the plan at <absolute plan path>. Run git diff main...HEAD. Do not modify files, commit, or move HEAD. Look for bugs, missing tests, and departures from the plan; run the tests. Send me a message that starts with "verdict: approve" or "verdict: changes requested", then each comment with file and line.'
39
+ ```
40
+
41
+ Its id is <reviewer id>. Do not pass `--archive-on-idle`: later reviews go to this reviewer with `vibest send`.
42
+
43
+ ## 5. Until approval
44
+
45
+ - `changes requested` → `vibest send <implementer id> -- '<the comments, verbatim. Fix them, run the tests, commit, push, and send me the hash.>'` When it sends its message, `vibest send <reviewer id> -- 'The implementer pushed <hash>. Review again. Same message format.'`
46
+ - `approve` → open the pull request.
47
+ - After 3 reviews without approval, or a judgment call, stop and show the open comments. The user decides: another review, accept, or change the plan.
48
+
49
+ One line to the user per review: the number, the verdict, what is being fixed.
50
+
51
+ ## 6. Pull request
52
+
53
+ ```
54
+ vibest send <implementer id> -- 'The review approved the change. Open a pull request against main with gh pr create. Title: <title>. Body: the plan, the change, and how it was verified. Send me the URL.'
55
+ ```
56
+
57
+ Give the user the URL. Then `vibest archive <reviewer id>`. Keep the implementer until the user is done; follow-ups are `vibest send <implementer id> -- '<message>'`.
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "vibest",
3
+ "description": "VIBEST for Claude Code: execution-end reports, prompt reports and the tool guard for VIBEST sessions, and the entry session inbox that delivers VIBEST messages as prompts, all over HTTP to vibestd",
4
+ "author": {
5
+ "name": "vibest-dev"
6
+ },
7
+ "repository": "https://github.com/vibest-dev/vibest",
8
+ "license": "MIT",
9
+ "version": "0.0.2-beta.2"
10
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 iamdin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,107 @@
1
+ # @vibest/claude: the vibest Claude Code plugin
2
+
3
+ One ordinary Claude Code plugin, one hooks module. Every call to vibest is an HTTP request from `$.http.fetch` to
4
+ vibestd's unix socket `<VIBEST_HOME>/vibest-http.sock`; the plugin runs no `vibest` process.
5
+
6
+ - `turn.complete` posts each main-loop execution end to `/hooks/claude/execution-end` with its `reason`, the answer and the
7
+ current Claude session id. vibest maps the reason: `answer` is the result as it is; `aborted` is an interrupted
8
+ (failed) result when the person pressed Esc, and nothing when `vibest interrupt` (or remove, archive) stopped the
9
+ execution; `refusal` and `error` are failed results. A subagent's loop (`agentId` set) reports nothing. For the
10
+ entry session vibestd records only the conversation id.
11
+ - `prompt.submit` posts a worker's prompt with its `origin.kind` to `/hooks/claude/prompt`; vibest keeps only what
12
+ the person submitted (`composer`, or `bridge` for Remote Control).
13
+ - `tool.call` posts each tool call, a subagent's included, to `/hooks/claude/guard` and returns `{ deny }` when vibest
14
+ refuses it. It tries for 2 s, then again after 100, 300 and 900 ms; when nothing answers, the call is refused.
15
+ - The **inbox**: from `session.start`, a session asks `/inbox/take` every second while it is idle (after `session.start`
16
+ and `turn.complete`, never while an execution runs). A batch comes with its execution id,
17
+ the two-line form (`Message from @General · <title> (<id>)` then the first line; a notice is `Message from Vibest`, a user send is `Message from You`) and its full text. The line is submitted with
18
+ `$.prompt.submit` from the AbovePrompt `ui.render` hook, one batch per draw, and this module's own `prompt.submit`
19
+ hook attaches the full text as context. This module's own `prompt.submit` hook reports the batch's execution as accepted
20
+ (`PromptSubmit` with `origin: "vibest"` and the execution id) before the prompt goes on; a
21
+ `drop` puts the batch back at the front of the queue. The submit has to come from inside a hook's call stack: a
22
+ submit from a clock callback would skip this module's own `prompt.submit` hook as re-entry. The render hook awaits
23
+ the submit before it returns: Claude Code reads the call against the hooks still running when it arrives, and under
24
+ load a hook that returned at once had often settled first, so its own `prompt.submit` hook was skipped the same way
25
+ and the line went out without its full text. Full texts wait for `prompt.submit` for at most the last 100 lines. When the submitted text already ends with the full content, that content is not attached again. Using the AbovePrompt render hook as a place to submit from is undocumented; E2E covers it.
26
+
27
+ Reports (execution end, prompt) retry in the background after 1, 2, 4, 8, 15 and 30 s while vibestd does not take them.
28
+ A failed report never blocks or continues a stopped execution. Five failed polls in a row put "vibestd unreachable" on the
29
+ status line. `Session.Ready` goes with Claude Code's own pid, read as the `$PPID` of a command the module runs, since
30
+ a restart signals that process. A failed hook is skipped unless its handler answers, so outside vibest every listener
31
+ answers with a pass. The tool arguments sent to the guard are the `tool.call` input without its reserved keys
32
+ (`tool`, `tool_use_id`, `consent`, `agentId`).
33
+
34
+ Every request carries the session headers from `@vibest/protocol` `sessionHeaders`: protocol, `VIBEST_SESSION_ID`,
35
+ `VIBEST_PROJECT_ID`, the current Claude session id, `VIBEST_HARNESS`, the cwd, `VIBEST_RUNTIME` and the
36
+ plugin version. Paths carry no version; the only one is `PROTOCOL` in the `vibest-protocol` header. vibestd refuses a
37
+ request with an unknown session (404), a missing or wrong project id (403) or another protocol (409). A 409 body holds
38
+ vibestd's protocol and version, a message and the command to run (`action`); the plugin puts them on the status line
39
+ until a request goes through again, and the guard still refuses each tool call, giving them as the reason.
40
+
41
+ It ships inside `@vibest/cli` and is loaded only into the Claude sessions vibest starts (see Use).
42
+
43
+ ## Build
44
+
45
+ This package is private: the plugin is published as part of `@vibest/cli`, whose build writes it to
46
+ `packages/cli/harnesses/claude` (`scripts/build-harnesses.ts`).
47
+
48
+ bun scripts/build.ts <outdir> # the complete plugin directory in <outdir>
49
+ bun run build # the generated files in place, for the tests
50
+
51
+ The plugin directory holds exactly:
52
+
53
+ - `.claude-plugin/plugin.json`, generated: `src/manifest.json` with `version` set from this `package.json`.
54
+ - `hooks/hooks.json`: `"modules": ["./register.mjs"]` only. No command-hook map and no shell wrapper.
55
+ - `hooks/register.mjs`, generated: a single ES module with no imports. It bundles `src/plugin.ts` with the header
56
+ helper it imports from `@vibest/protocol`; the build inlines the package version as `VIBEST_PLUGIN_VERSION`. Prebuilt JS is a delivery choice; Claude Code can also load TypeScript hooks modules.
57
+ - `README.md` and `LICENSE`.
58
+
59
+ `$.plugin` has no version, so the build inlines it. Bun writes each module's path relative to the working directory
60
+ into the bundle, so the build pins the working directory and the bytes do not vary.
61
+
62
+ The generated files are ignored by Git.
63
+
64
+ ## Use
65
+
66
+ The launch side (arguments, models, resume, subscription reading) is the `claude` harness definition, added by the
67
+ builtin plugin `harness-claude` in `packages/plugin-harnesses`; this package is only what runs inside Claude.
68
+
69
+ Nothing to install. vibest starts each Claude session (and a Claude entry session) with
70
+ `claude --plugin-dir <@vibest/cli>/harnesses/claude`, which loads the plugin for that session only. vibest writes
71
+ nothing into `~/.claude`. Plain `claude` sessions never load it, and in a Claude process without
72
+ `VIBEST_SESSION_ID` every listener returns `next` and sends nothing.
73
+
74
+ **Mods are not sandboxed.** The module is code that Claude Code runs in its own process with your permissions. What it
75
+ does is narrow: POST to the fixed vibestd socket and submit the inbox line as a prompt. Its `tool.call` listener only
76
+ refuses; it registers no `tool.check` approval and changes no permission or policy setting. A module that does not
77
+ load guards nothing: vibest's `--settings` only grants the project folder, so the guard rules hold only while this
78
+ module runs.
79
+
80
+ **`/clear`.** Claude Code 2.1.316 changes `$.session.id()` on `/clear`, fires `session.end` for the old id and no new
81
+ `session.start`; the poll timer keeps running. The plugin therefore has no `session.end` handler and sends the
82
+ current id on every request, and vibestd records the new id on the next request.
83
+
84
+ **Loading gate.** Claude Code statically analyzes a hooks module before loading it: `register` stays a top-level
85
+ `function` declaration and each hook passes `$` only to the top-level `nativeHost`. Hooks modules must be enabled for
86
+ non-builtin plugins (in 2.1.309 the rollout flag `tengu_plugin_hooks_modules` and accepted workspace trust); the plugin
87
+ does not read or change either. The AbovePrompt drain needs an interactive UI: under `claude -p` nothing is delivered.
88
+
89
+ ## API source
90
+
91
+ `src/plugin.ts` imports types from `claude-code`. Those declarations are not in this repository. `bun scripts/prepare-claude-types.ts`,
92
+ which `pnpm run typecheck` runs before the plugin project (`tsconfig.plugin.json`), writes an ignored cache at
93
+ `packages/integration/claude/.cache/claude-code.d.ts`. A cold cache needs network access to GitHub.
94
+ It reuses that file only when its SHA-256 is `e51e637fbbebb2a6a49c4bdc3860a251c2ca2295884822dff0f4c3e3ec802163`, including a copy placed there by hand for offline use. Otherwise it fetches
95
+ `https://raw.githubusercontent.com/anthropics/claude-code/2eff7a8d21c80be48904f62ebdea36d945d7b504/mods/types/claude-code.d.ts` and keeps the result only when that checksum matches.
96
+ The pin is anthropics/claude-code `2eff7a8d21c80be48904f62ebdea36d945d7b504`, `mods/types/claude-code.d.ts`. The file's own
97
+ "Written by Claude Code 2.1.277" header is stale and does not date that pin. Upstream marks the file all rights reserved
98
+ under Anthropic's commercial terms. This repository does not assert permission to redistribute it, and a missing or
99
+ unverified cache fails typecheck instead of skipping the plugin project. The cache was not produced by running Claude or `/plugin-types`.
100
+
101
+ The listeners are `session.start`, `ui.render` (AbovePrompt), `turn.complete`, `prompt.submit` and `tool.call`. Native
102
+ calls stay in `register` or the top-level `nativeHost`: `$.http.fetch`, `$.session.cwd`, `$.session.id`, `$.env.get`,
103
+ `$.prompt.submit`, `$.clock.every`, `$.clock.after`, `$.ui.invalidate`, `$.ui.status`.
104
+
105
+ Hooks modules are early access and may change between releases. `claude plugin validate` and `claude plugin test` have
106
+ not been run on this revision. The E2E check I4 loads it with `--plugin-dir` into a real Claude: the guard refuses and the
107
+ execution end reports.
@@ -0,0 +1,4 @@
1
+ {
2
+ "description": "VIBEST: execution-end reports and the tool guard for VIBEST sessions; the entry session inbox module",
3
+ "modules": ["./register.mjs"]
4
+ }