@vibest/cli 0.0.2-beta.2 → 0.0.2-beta.4

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.
@@ -1,25 +1,8 @@
1
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.
2
+ # @vibest/agy 0.0.2-beta.4: `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_CLI), not the first vibest on PATH, which a login shell may reorder.
5
4
  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 "$@"
5
+ command "${VIBEST_CLI:-vibest}" "$@"
23
6
  }
24
7
  log="${VIBEST_HOME:-$HOME/.vibest}/vibestd.log"
25
8
  # Hooks carry no subagent marker: the first conversation this process reports is its own; agy's subagents are not.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "vibest",
3
- "version": "0.0.2-beta.2",
3
+ "version": "0.0.2-beta.4",
4
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
5
  }
@@ -12,18 +12,13 @@ You direct subagents. You stay with the user. An agent messages you when it fini
12
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
13
 
14
14
  ```
15
- vibest run [<harness>] --title '<Title>' -- '<self-contained task>'
15
+ vibest run [<harness>] [--agent <id>] --title '<Title>' -- '<self-contained task>'
16
16
  ```
17
17
 
18
18
  Its id is <id>.
19
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.
20
+ - `--agent <id>`: pick the agent whose description fits the piece of work (your session facts list them; `vibest agent list` is the current list). Without it the session is `general`.
21
+ - Leave `<harness>` out to use the agent's own harness when it has one, else your own harness, provider and model; name one (`pi`, `claude`, `cursor`, or any harness a plugin adds; `vibest harness list`) to switch.
27
22
  - 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
23
  - Each session gets its own new worktree.
29
24
  - Several `vibest run` commands in one message start in parallel.
@@ -57,9 +52,9 @@ Then say what changed, the evidence, and the branch. `<id>` is the id the run pr
57
52
 
58
53
  ## Finish
59
54
 
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.
55
+ - Archive a research, review or verification session with `vibest archive <id>` once you have read its message and will not continue it.
56
+ - Keep an agent that changed code until the user asks to archive 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.
57
+ - A `## Remember` section in a message: maintain both the topic file `$VIBEST_PROJECT_DIR/memories/<name>.md` (one lesson per file, starting with frontmatter `name` and `description` or a one-line summary, with the detail kept in the topic file) and its one-line entry (`- memories/<name>.md — <summary>`, under 150 characters) in `$VIBEST_PROJECT_DIR/memories/MEMORY.md`. Only `memories/MEMORY.md` is loaded into the system prompt (capped at 100 lines and 8000 bytes); topic files are read on demand or searched with `vibest project search <query> --kind memories`. When a lesson changes or turns out to be wrong, update or delete its topic file and update or remove its entry in `memories/MEMORY.md` instead of only appending; compact `memories/MEMORY.md` to under 70 lines when it approaches the cap.
63
58
 
64
59
  ## The user steps into a pane
65
60
 
@@ -13,7 +13,7 @@ Plan → the user agrees → implement → review until the reviewer approves
13
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
14
  ```
15
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.
16
+ Its id is <planner id>. Tell the user the plan is being written and end your execution.
17
17
 
18
18
  ## 2. Agree
19
19
 
@@ -27,7 +27,7 @@ Save the agreed plan, verbatim, with your file tool as `$VIBEST_PROJECT_DIR/arti
27
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
28
  ```
29
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.
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. When it sends its message, check the diff and the tests yourself before review.
31
31
 
32
32
  ## 4. Review
33
33
 
@@ -38,7 +38,7 @@ Read-only here is the prompt you pass, plus the shared-worktree git rule the ses
38
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
39
  ```
40
40
 
41
- Its id is <reviewer id>. Do not pass `--archive-on-idle`: later reviews go to this reviewer with `vibest send`.
41
+ Its id is <reviewer id>.
42
42
 
43
43
  ## 5. Until approval
44
44
 
@@ -6,5 +6,5 @@
6
6
  },
7
7
  "repository": "https://github.com/vibest-dev/vibest",
8
8
  "license": "MIT",
9
- "version": "0.0.2-beta.2"
9
+ "version": "0.0.2-beta.4"
10
10
  }
@@ -64,7 +64,7 @@ The generated files are ignored by Git.
64
64
  ## Use
65
65
 
66
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.
67
+ builtin plugin `vibest.harness-claude` in `packages/plugin-harnesses`; this package is only what runs inside Claude.
68
68
 
69
69
  Nothing to install. vibest starts each Claude session (and a Claude entry session) with
70
70
  `claude --plugin-dir <@vibest/cli>/harnesses/claude`, which loads the plugin for that session only. vibest writes
@@ -5475,9 +5475,6 @@ class AgentRefused extends TaggedError3()("AgentRefused", {
5475
5475
  }
5476
5476
  }
5477
5477
 
5478
- class HookFailed extends TaggedError3()("HookFailed", { message: String4 }) {
5479
- }
5480
-
5481
5478
  class PluginsNotActive extends TaggedError3()("PluginsNotActive", {
5482
5479
  plugins: ArraySchema(String4)
5483
5480
  }) {
@@ -5542,7 +5539,9 @@ var SessionCreated = fact("session.created", "session", {
5542
5539
  name: Text,
5543
5540
  directory: String4,
5544
5541
  parent: optional3(Text),
5545
- origin: optional3(Struct({ peer: Text, project: Text, session: optional3(Text) }))
5542
+ origin: optional3(Struct({ peer: Text, project: Text, session: optional3(Text) })),
5543
+ message: optional3(Seq),
5544
+ team: optional3(Text)
5546
5545
  });
5547
5546
  var SessionRenamed = fact("session.renamed", "session", { name: Text });
5548
5547
  var SessionDirectoryChanged = fact("session.directory_changed", "session", { directory: Text });
@@ -5565,51 +5564,117 @@ var ProcessReady = fact("process.ready", "session", {
5565
5564
  });
5566
5565
  var ProcessPid = fact("process.pid", "session", { process: Seq, pid: Pid });
5567
5566
  var ProcessConversation = fact("process.conversation", "session", { process: Seq, conversation: Text });
5567
+ var AgentFrom = Struct({
5568
+ session: String4,
5569
+ agent: optional3(String4),
5570
+ title: optional3(String4),
5571
+ machine: optional3(String4)
5572
+ });
5573
+ var AgentSender = Struct({ type: Literal2("agent"), ...AgentFrom.fields });
5574
+ var PluginSender = Struct({ type: Literal2("plugin"), plugin: Text });
5575
+ var Sender = Union2([
5576
+ AgentSender,
5577
+ PluginSender,
5578
+ Struct({ type: Literal2("vibest") }),
5579
+ Struct({ type: Literal2("user") })
5580
+ ]);
5568
5581
  var ProcessEndReason = Literals([
5569
5582
  "exited",
5570
- "limited",
5571
5583
  "restart",
5572
5584
  "move",
5573
5585
  "archived",
5574
5586
  "launch_failed",
5575
- "superseded"
5587
+ "superseded",
5588
+ "stopped"
5576
5589
  ]);
5577
- var ProcessEnded = fact("process.ended", "session", { process: Seq, reason: ProcessEndReason });
5578
- var ExecutionStarted = fact("execution.started", "session", {
5579
- process: optional3(Seq),
5590
+ var ProcessEnded = fact("process.ended", "session", {
5591
+ process: Seq,
5592
+ reason: ProcessEndReason,
5593
+ by: optional3(Sender)
5594
+ });
5595
+ var ExecutionOutcome = Literals(["completed", "failed", "interrupted", "lost", "not_started"]);
5596
+ var ExecutionObservation = Literals(["lost", "not_started"]);
5597
+ var ExecutionFailure = Struct({
5598
+ message: Text,
5599
+ kind: optional3(Literal2("limit")),
5600
+ resetAt: optional3(Number5)
5601
+ });
5602
+ var ExecutionAllocated = fact("execution.allocated", "session", {
5603
+ executionId: Seq,
5604
+ processId: optional3(Seq),
5580
5605
  typed: optional3(Text)
5581
5606
  });
5582
5607
  var ExecutionAccepted = fact("execution.accepted", "session", { execution: Seq });
5583
- var ExecutionOutcome = Literals(["completed", "failed", "interrupted", "lost", "not_started"]);
5584
- var ExecutionEnded = fact("execution.ended", "session", {
5585
- execution: Seq,
5586
- outcome: ExecutionOutcome,
5587
- failure: optional3(Struct({ message: Text, kind: optional3(Literal2("limit")) })),
5588
- conversation: optional3(Text),
5608
+ var ExecutionStarted = fact("execution.started", "session", {
5609
+ executionId: Seq,
5610
+ processId: optional3(Seq)
5611
+ });
5612
+ var ExecutionSucceeded = fact("execution.succeeded", "session", {
5613
+ executionId: Seq,
5589
5614
  reply: optional3(String4)
5590
5615
  });
5591
- var InboxKind = Literals(["task", "send", "notice"]);
5592
- var Sender = Struct({
5593
- session: String4,
5594
- agent: optional3(String4),
5595
- title: optional3(String4),
5596
- machine: optional3(String4)
5616
+ var ExecutionFailed = fact("execution.failed", "session", {
5617
+ executionId: Seq,
5618
+ failure: ExecutionFailure,
5619
+ reply: optional3(String4)
5597
5620
  });
5598
- var InboxQueued = fact("inbox.queued", "session", {
5599
- kind: InboxKind,
5600
- recipient: optional3(Text),
5601
- sender: optional3(Text),
5602
- from: optional3(Sender),
5621
+ var ExecutionInterrupted = fact("execution.interrupted", "session", {
5622
+ executionId: Seq,
5623
+ reason: optional3(Text),
5624
+ reply: optional3(String4)
5625
+ });
5626
+ var ExecutionUnresolved = fact("execution.unresolved", "session", {
5627
+ executionId: Seq,
5628
+ observation: ExecutionObservation,
5629
+ failure: optional3(ExecutionFailure),
5630
+ reply: optional3(String4)
5631
+ });
5632
+ var ExecutionInput = fact("execution.input", "session", {
5633
+ executionId: Seq,
5634
+ typed: Text
5635
+ });
5636
+ var InboxHistory = Literals([
5637
+ "route",
5638
+ "delivered_without_execution",
5639
+ "failed_unspecified",
5640
+ "unconfirmed",
5641
+ "released"
5642
+ ]);
5643
+ var InboxEnqueued = fact("inbox.enqueued", "session", {
5644
+ sender: Sender,
5603
5645
  content: String4,
5604
- status: Literals(["pending", "delivered", "dropped"]),
5605
- request: optional3(Text),
5606
- peerItem: optional3(Text)
5646
+ senderExecutionId: optional3(Seq),
5647
+ requestId: optional3(Text),
5648
+ transferId: optional3(Text),
5649
+ aboutSessionId: optional3(Text)
5607
5650
  });
5608
- var InboxMoved = fact("inbox.moved", "session", {
5609
- inbox: Seq,
5610
- to: Literals(["pending", "delivering", "delivered", "failed", "dropped"]),
5651
+ var InboxDeliveryStarted = fact("inbox.delivery_started", "session", {
5652
+ messageId: Seq,
5611
5653
  execution: optional3(Seq)
5612
5654
  });
5655
+ var InboxDelivered = fact("inbox.delivered", "session", {
5656
+ messageId: Seq,
5657
+ recipientExecutionId: Seq
5658
+ });
5659
+ var InboxDeliveryFailed = fact("inbox.delivery_failed", "session", {
5660
+ messageId: Seq,
5661
+ reason: Text
5662
+ });
5663
+ var InboxDropped = fact("inbox.dropped", "session", {
5664
+ messageId: Seq,
5665
+ reason: Text
5666
+ });
5667
+ var InboxUnresolved = fact("inbox.unresolved", "session", {
5668
+ history: InboxHistory,
5669
+ messageId: optional3(Seq),
5670
+ execution: optional3(Seq),
5671
+ sender: optional3(Sender),
5672
+ content: optional3(String4),
5673
+ senderExecutionId: optional3(Seq),
5674
+ requestId: optional3(Text),
5675
+ transferId: optional3(Text),
5676
+ aboutSessionId: optional3(Text)
5677
+ });
5613
5678
  var MachineAdded = fact("machine.added", "ledger", { name: Text, target: Text, vibestd: Text });
5614
5679
  var MachineConnected = fact("machine.connected", "ledger", { name: Text });
5615
5680
  var MachineRemoved = fact("machine.removed", "ledger", { name: Text });
@@ -5621,7 +5686,8 @@ var OutboxQueued = fact("outbox.queued", "ledger", {
5621
5686
  recipient: optional3(Text),
5622
5687
  kind: optional3(Literals(["send", "notice"])),
5623
5688
  content: String4,
5624
- from: optional3(Sender)
5689
+ from: optional3(AgentFrom),
5690
+ execution: optional3(Seq)
5625
5691
  });
5626
5692
  var OutboxAcked = fact("outbox.acked", "ledger", { peer: Text, ids: NonEmptyArray(Text) });
5627
5693
  var Catalog = {
@@ -5639,11 +5705,20 @@ var Catalog = {
5639
5705
  [ProcessPid.type]: ProcessPid,
5640
5706
  [ProcessConversation.type]: ProcessConversation,
5641
5707
  [ProcessEnded.type]: ProcessEnded,
5642
- [ExecutionStarted.type]: ExecutionStarted,
5708
+ [ExecutionAllocated.type]: ExecutionAllocated,
5643
5709
  [ExecutionAccepted.type]: ExecutionAccepted,
5644
- [ExecutionEnded.type]: ExecutionEnded,
5645
- [InboxQueued.type]: InboxQueued,
5646
- [InboxMoved.type]: InboxMoved,
5710
+ [ExecutionStarted.type]: ExecutionStarted,
5711
+ [ExecutionSucceeded.type]: ExecutionSucceeded,
5712
+ [ExecutionFailed.type]: ExecutionFailed,
5713
+ [ExecutionInterrupted.type]: ExecutionInterrupted,
5714
+ [ExecutionUnresolved.type]: ExecutionUnresolved,
5715
+ [ExecutionInput.type]: ExecutionInput,
5716
+ [InboxEnqueued.type]: InboxEnqueued,
5717
+ [InboxDeliveryStarted.type]: InboxDeliveryStarted,
5718
+ [InboxDelivered.type]: InboxDelivered,
5719
+ [InboxDeliveryFailed.type]: InboxDeliveryFailed,
5720
+ [InboxDropped.type]: InboxDropped,
5721
+ [InboxUnresolved.type]: InboxUnresolved,
5647
5722
  [MachineAdded.type]: MachineAdded,
5648
5723
  [MachineConnected.type]: MachineConnected,
5649
5724
  [MachineRemoved.type]: MachineRemoved,
@@ -5671,7 +5746,7 @@ var ExecutionState = Literals([
5671
5746
  "lost",
5672
5747
  "not_started"
5673
5748
  ]);
5674
- var InboxStatus = Literals(["pending", "delivering", "delivered", "failed", "dropped"]);
5749
+ var InboxStatus = Literals(["pending", "delivering", "delivered", "failed", "dropped", "unresolved"]);
5675
5750
  var RuntimeAddress = Struct({
5676
5751
  machine: String4,
5677
5752
  id: String4
@@ -5686,30 +5761,13 @@ var RuntimeMachine = Struct({
5686
5761
  });
5687
5762
  var InboxRow = Struct({
5688
5763
  id: Number5,
5689
- sender: NullOr(String4),
5690
- from: NullOr(Sender),
5764
+ sender: Sender,
5691
5765
  recipient: NullOr(String4),
5692
- kind: InboxKind,
5693
5766
  message: String4,
5694
5767
  status: InboxStatus
5695
5768
  });
5696
5769
  var Detail = Struct({
5697
- sender: Union2([
5698
- Struct({
5699
- agent: String4,
5700
- title: String4,
5701
- session: String4,
5702
- machine: String4
5703
- }),
5704
- Struct({
5705
- agent: String4,
5706
- title: String4,
5707
- session: String4
5708
- }),
5709
- Struct({ address: String4 }),
5710
- Literal2("vibest"),
5711
- Literal2("user")
5712
- ]),
5770
+ sender: Sender,
5713
5771
  message: String4
5714
5772
  });
5715
5773
  var Taken = Struct({
@@ -5770,12 +5828,6 @@ class SessionBusy extends TaggedError3()("SessionBusy", {
5770
5828
  }) {
5771
5829
  }
5772
5830
 
5773
- class LimitReached extends TaggedError3()("LimitReached", { limit: Number5 }) {
5774
- get message() {
5775
- return `VIBEST_MAX_SESSIONS=${this.limit} sessions are already open (working or kept); vibest archive one first`;
5776
- }
5777
- }
5778
-
5779
5831
  class NotReady extends TaggedError3()("NotReady", {
5780
5832
  id: String4,
5781
5833
  message: String4
@@ -5790,9 +5842,12 @@ class NoCallingSession extends TaggedError3()("NoCallingSession", {}) {
5790
5842
 
5791
5843
  class UnknownAgent extends TaggedError3()("UnknownAgent", {
5792
5844
  agent: String4,
5793
- known: ArraySchema(Struct({ id: String4, description: String4 }))
5845
+ known: ArraySchema(Struct({ id: String4, description: String4 })),
5846
+ invalid: optional2(String4)
5794
5847
  }) {
5795
5848
  get message() {
5849
+ if (this.invalid !== undefined)
5850
+ return `agent definition ${this.agent} is invalid: ${this.invalid}`;
5796
5851
  const known = this.known.map((definition) => `${definition.id} (${definition.description})`).join("; ");
5797
5852
  return `no agent definition ${this.agent}; registered: ${known || "none"}`;
5798
5853
  }
@@ -5829,9 +5884,26 @@ var HarnessChoice = Struct({
5829
5884
  problem: NullOr(String4),
5830
5885
  models: ArraySchema(HarnessModel)
5831
5886
  });
5887
+ var AgentListing = Struct({
5888
+ agents: ArraySchema(Struct({
5889
+ id: String4,
5890
+ description: String4,
5891
+ plugin: String4,
5892
+ harness: optional2(String4),
5893
+ provider: optional2(String4),
5894
+ model: optional2(String4),
5895
+ system: String4
5896
+ })),
5897
+ invalid: ArraySchema(Struct({
5898
+ id: optional2(String4),
5899
+ source: String4,
5900
+ error: String4,
5901
+ plugin: String4
5902
+ }))
5903
+ });
5832
5904
 
5833
5905
  // ../../schema/src/version.ts
5834
- var PROTOCOL = 12;
5906
+ var PROTOCOL = 14;
5835
5907
 
5836
5908
  // ../../protocol/src/protocol.ts
5837
5909
  var PROTOCOL_HEADER = "vibest-protocol";
@@ -5881,24 +5953,23 @@ var clip = (s) => {
5881
5953
  const cps = [...s];
5882
5954
  return cps.length <= PREVIEW ? s : `${cps.slice(0, PREVIEW - 1).join("")}…`;
5883
5955
  };
5884
- var remote = (address) => {
5885
- const slash = address.indexOf("/");
5886
- if (slash <= 0)
5887
- return `Message from @${titled(address)}`;
5888
- const machine = address.slice(0, slash);
5889
- const id = address.slice(slash + 1, slash + 9);
5890
- return `Message from @${titled(machine)} · (${machine}/${id})`;
5956
+ var agentHead = (sender) => {
5957
+ const id = sender.session.slice(0, 8);
5958
+ if (sender.agent !== undefined)
5959
+ return `Message from @${titled(sender.agent)} · ${sender.title ?? ""} (${sender.machine === undefined ? id : `${sender.machine}/${id}`})`;
5960
+ return sender.machine === undefined ? `Message from @${titled(id)}` : `Message from @${titled(sender.machine)} · (${sender.machine}/${id})`;
5891
5961
  };
5892
5962
  var head2 = (sender) => {
5893
- if (sender === "vibest")
5894
- return "Message from Vibest";
5895
- if (sender === "user")
5896
- return "Message from You";
5897
- if ("machine" in sender)
5898
- return `Message from @${titled(sender.agent)} · ${sender.title} (${sender.machine}/${sender.session.slice(0, 8)})`;
5899
- if ("address" in sender)
5900
- return remote(sender.address);
5901
- return `Message from @${titled(sender.agent)} · ${sender.title} (${sender.session.slice(0, 8)})`;
5963
+ switch (sender.type) {
5964
+ case "vibest":
5965
+ return "Message from Vibest";
5966
+ case "user":
5967
+ return "Message from You";
5968
+ case "plugin":
5969
+ return `Message from Vibest · ${sender.plugin}`;
5970
+ case "agent":
5971
+ return agentHead(sender);
5972
+ }
5902
5973
  };
5903
5974
  var shown = (detail) => detail.map((entry) => `${head2(entry.sender)}
5904
5975
  ${clip(entry.message.trim().split(`
@@ -5921,6 +5992,8 @@ function nativeHost($) {
5921
5992
  return $.env.get("VIBEST_HOME");
5922
5993
  case "VIBEST_PROCESS":
5923
5994
  return $.env.get("VIBEST_PROCESS");
5995
+ case "VIBEST_EXECUTION":
5996
+ return $.env.get("VIBEST_EXECUTION");
5924
5997
  case "HOME":
5925
5998
  return $.env.get("HOME");
5926
5999
  }
@@ -5965,6 +6038,12 @@ var errorOf = (body) => {
5965
6038
  const error = member(body, "error");
5966
6039
  return isString(error) ? error : undefined;
5967
6040
  };
6041
+ var parseExecution = (raw) => {
6042
+ if (raw === undefined || !/^[1-9]\d*$/.test(raw))
6043
+ return;
6044
+ const parsed = Number(raw);
6045
+ return Number.isSafeInteger(parsed) ? parsed : undefined;
6046
+ };
5968
6047
  function register(on) {
5969
6048
  const queue = [];
5970
6049
  const full = new Map;
@@ -5975,6 +6054,21 @@ function register(on) {
5975
6054
  let mismatched = false;
5976
6055
  let timer;
5977
6056
  let processId;
6057
+ let bound;
6058
+ let initialPending;
6059
+ let initialBoundRead = false;
6060
+ const ensureInitialBound = async (host) => {
6061
+ if (initialBoundRead)
6062
+ return;
6063
+ initialBoundRead = true;
6064
+ const initial = parseExecution(await host.env("VIBEST_EXECUTION").catch(() => {
6065
+ return;
6066
+ }));
6067
+ if (bound === undefined && initial !== undefined) {
6068
+ bound = initial;
6069
+ initialPending = initial;
6070
+ }
6071
+ };
5978
6072
  const identity = async (host) => {
5979
6073
  const sessionId = await host.env("VIBEST_SESSION_ID");
5980
6074
  if (!sessionId)
@@ -5997,7 +6091,7 @@ function register(on) {
5997
6091
  return;
5998
6092
  }),
5999
6093
  runtime: await host.env("VIBEST_RUNTIME"),
6000
- pluginVersion: "0.0.2-beta.2",
6094
+ pluginVersion: "0.0.2-beta.4",
6001
6095
  process: processId ?? await host.env("VIBEST_PROCESS")
6002
6096
  });
6003
6097
  const r = await timeout2(host.fetch(who.socket, path, { ...headers, "content-type": "application/json" }, JSON.stringify(body)), ms, host.after);
@@ -6072,6 +6166,7 @@ function register(on) {
6072
6166
  };
6073
6167
  on("session.start", async ($, e, next) => {
6074
6168
  const host = nativeHost($);
6169
+ await ensureInitialBound(host);
6075
6170
  if (await identity(host).catch(() => {
6076
6171
  return;
6077
6172
  })) {
@@ -6083,11 +6178,18 @@ function register(on) {
6083
6178
  if (isNumber(current))
6084
6179
  processId = String(current);
6085
6180
  });
6181
+ if (bound !== undefined)
6182
+ report(host, hookRoute("claude", "prompt"), {
6183
+ hook_event_name: "PromptSubmit",
6184
+ origin: "vibest",
6185
+ execution: bound
6186
+ });
6086
6187
  }
6087
- idle = true;
6188
+ idle = bound === undefined;
6088
6189
  if (timer === undefined && await identity(host)) {
6089
6190
  timer = host.every(POLL_MS, () => void tick(host));
6090
- tick(host);
6191
+ if (idle)
6192
+ tick(host);
6091
6193
  }
6092
6194
  return next(e);
6093
6195
  });
@@ -6128,12 +6230,17 @@ function register(on) {
6128
6230
  return;
6129
6231
  });
6130
6232
  idle = true;
6233
+ await ensureInitialBound(host);
6234
+ const execution = bound;
6235
+ bound = undefined;
6236
+ initialPending = undefined;
6131
6237
  if (who)
6132
6238
  report(host, hookRoute("claude", "execution-end"), {
6133
6239
  hook_event_name: "ExecutionComplete",
6134
6240
  session_id: await host.conversation().catch(() => ""),
6135
6241
  reason: event.reason,
6136
6242
  last_assistant_message: event.answer,
6243
+ ...execution !== undefined && { execution },
6137
6244
  ...event.reason === "refusal" && { refusal: event.refusal }
6138
6245
  });
6139
6246
  }
@@ -6149,15 +6256,28 @@ function register(on) {
6149
6256
  full.delete(event.text);
6150
6257
  if (taken === undefined)
6151
6258
  return next(event);
6259
+ initialBoundRead = true;
6260
+ initialPending = undefined;
6261
+ bound = taken.execution;
6152
6262
  await report(host, hookRoute("claude", "prompt"), {
6153
6263
  hook_event_name: "PromptSubmit",
6154
6264
  origin: "vibest",
6155
- execution: taken.execution
6265
+ execution: taken.execution,
6266
+ ids: taken.ids
6156
6267
  });
6157
6268
  if (event.text.trimEnd().endsWith(taken.content.trim()))
6158
6269
  return next(event);
6159
6270
  return next({ ...event, context: [...event.context ?? [], taken.content] });
6160
6271
  }
6272
+ await ensureInitialBound(host);
6273
+ if (event.origin.kind === "composer" && initialPending !== undefined) {
6274
+ initialPending = undefined;
6275
+ return next(event);
6276
+ }
6277
+ if (event.origin.kind === "composer" || event.origin.kind === "bridge") {
6278
+ initialPending = undefined;
6279
+ bound = undefined;
6280
+ }
6161
6281
  const who = await identity(host).catch(() => {
6162
6282
  return;
6163
6283
  });
@@ -12,18 +12,13 @@ You direct subagents. You stay with the user. An agent messages you when it fini
12
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
13
 
14
14
  ```
15
- vibest run [<harness>] --title '<Title>' -- '<self-contained task>'
15
+ vibest run [<harness>] [--agent <id>] --title '<Title>' -- '<self-contained task>'
16
16
  ```
17
17
 
18
18
  Its id is <id>.
19
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.
20
+ - `--agent <id>`: pick the agent whose description fits the piece of work (your session facts list them; `vibest agent list` is the current list). Without it the session is `general`.
21
+ - Leave `<harness>` out to use the agent's own harness when it has one, else your own harness, provider and model; name one (`pi`, `claude`, `cursor`, or any harness a plugin adds; `vibest harness list`) to switch.
27
22
  - 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
23
  - Each session gets its own new worktree.
29
24
  - Several `vibest run` commands in one message start in parallel.
@@ -57,9 +52,9 @@ Then say what changed, the evidence, and the branch. `<id>` is the id the run pr
57
52
 
58
53
  ## Finish
59
54
 
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.
55
+ - Archive a research, review or verification session with `vibest archive <id>` once you have read its message and will not continue it.
56
+ - Keep an agent that changed code until the user asks to archive 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.
57
+ - A `## Remember` section in a message: maintain both the topic file `$VIBEST_PROJECT_DIR/memories/<name>.md` (one lesson per file, starting with frontmatter `name` and `description` or a one-line summary, with the detail kept in the topic file) and its one-line entry (`- memories/<name>.md — <summary>`, under 150 characters) in `$VIBEST_PROJECT_DIR/memories/MEMORY.md`. Only `memories/MEMORY.md` is loaded into the system prompt (capped at 100 lines and 8000 bytes); topic files are read on demand or searched with `vibest project search <query> --kind memories`. When a lesson changes or turns out to be wrong, update or delete its topic file and update or remove its entry in `memories/MEMORY.md` instead of only appending; compact `memories/MEMORY.md` to under 70 lines when it approaches the cap.
63
58
 
64
59
  ## The user steps into a pane
65
60
 
@@ -13,7 +13,7 @@ Plan → the user agrees → implement → review until the reviewer approves
13
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
14
  ```
15
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.
16
+ Its id is <planner id>. Tell the user the plan is being written and end your execution.
17
17
 
18
18
  ## 2. Agree
19
19
 
@@ -27,7 +27,7 @@ Save the agreed plan, verbatim, with your file tool as `$VIBEST_PROJECT_DIR/arti
27
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
28
  ```
29
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.
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. When it sends its message, check the diff and the tests yourself before review.
31
31
 
32
32
  ## 4. Review
33
33
 
@@ -38,7 +38,7 @@ Read-only here is the prompt you pass, plus the shared-worktree git rule the ses
38
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
39
  ```
40
40
 
41
- Its id is <reviewer id>. Do not pass `--archive-on-idle`: later reviews go to this reviewer with `vibest send`.
41
+ Its id is <reviewer id>.
42
42
 
43
43
  ## 5. Until approval
44
44