Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
a0f4d5e
feat: [ENG-2737] HTML render layer foundation — element registry + pa…
danhdoan May 10, 2026
b321ca0
refactor: [ENG-2737] address review-agent feedback on render layer
danhdoan May 10, 2026
8b8b0b2
Merge pull request #627 from campfirein/feat/ENG-2737
danhdoan May 10, 2026
d2d3434
feat: [ENG-2738] HTML-emission contract in curate.txt + fluency check
danhdoan May 10, 2026
1be1dbd
feat: [ENG-2738] expand M1 vocabulary to match rendered MD structure
danhdoan May 10, 2026
eb470b5
feat: [ENG-2738] full writer-section coverage + fence sanitiser
danhdoan May 10, 2026
83c7720
feat: [ENG-2741] M1 telemetry producer — token + latency + format on …
RyanNg1403 May 10, 2026
3bdefe5
Merge pull request #628 from campfirein/feat/ENG-2738
danhdoan May 10, 2026
b58163e
Merge branch 'proj/html-mem-conversion' into feat/ENG-2741
RyanNg1403 May 10, 2026
a0fb2a2
refactor: [ENG-2741] address review-agent feedback on telemetry producer
RyanNg1403 May 10, 2026
f1cd87d
test: [ENG-2741] regression coverage for runAgentBody onTelemetry inv…
RyanNg1403 May 10, 2026
944813b
Merge pull request #629 from campfirein/feat/ENG-2741
RyanNg1403 May 10, 2026
7a4eb12
feat: [ENG-2739] curate path — HTML writer + format detector + execut…
danhdoan May 10, 2026
f701cd2
refactor: drop useHtmlContextTree flag — HTML is the only curate format
danhdoan May 10, 2026
cb6483c
fix: rewrite agent system prompt for HTML curate emission
danhdoan May 10, 2026
f969b1a
feat: inject system-managed createdat/updatedat onto bv-topic at writ…
danhdoan May 10, 2026
58b1308
fix: address review feedback + green up CI
danhdoan May 10, 2026
33765da
Merge pull request #630 from campfirein/feat/ENG-2739
danhdoan May 10, 2026
74a7c2c
feat: [ENG-2740] query path — HTML reader + element-axis index + sear…
danhdoan May 10, 2026
a3a514a
fix: address ENG-2740 PR review feedback
danhdoan May 10, 2026
a86d210
Merge pull request #631 from campfirein/feat/ENG-2740
danhdoan May 10, 2026
a130cea
fix: render HTML topics into structured markdown for Tier 2 direct re…
danhdoan May 10, 2026
8dd1c0a
Merge branch 'proj/html-mem-conversion' into fix/tier2-html-render
danhdoan May 10, 2026
2a1426d
Merge pull request #632 from campfirein/fix/tier2-html-render
danhdoan May 10, 2026
5d800c0
fix: extension-aware format detector for QueryLogEntry telemetry
RyanNg1403 May 10, 2026
c3f3831
fix: surface backend response on byterover stream terminating chunk
RyanNg1403 May 10, 2026
7d4f6cd
fix: align curate detail-preservation prompt with typed bv-* vocabulary
RyanNg1403 May 10, 2026
4b7c8c6
refactor: address review-agent feedback on telemetry followups
RyanNg1403 May 11, 2026
3816618
Merge pull request #633 from campfirein/fix/html-conversion-followups
RyanNg1403 May 11, 2026
13c09f2
feat: [ENG-2765] curate tool-mode session protocol — CLI surface + pl…
danhdoan May 11, 2026
3f5a600
fix: address ENG-2765 PR review feedback
danhdoan May 11, 2026
5cd5d3c
Merge pull request #636 from campfirein/feat/ENG-2765
danhdoan May 11, 2026
d595d74
feat: [ENG-2766] CurateOrchestrator state machine — real validate + w…
danhdoan May 11, 2026
4112533
Merge pull request #637 from campfirein/feat/ENG-2766
danhdoan May 11, 2026
663dcda
feat: [ENG-2767] curate prompt-builder — generate + correction from E…
danhdoan May 11, 2026
55c50d6
fix: address ENG-2767 PR review feedback — prompt-injection + delimit…
danhdoan May 11, 2026
fabb939
Merge pull request #638 from campfirein/feat/ENG-2767
danhdoan May 11, 2026
19b88a9
feat: [ENG-2768] document tool-mode curate session protocol in skill
danhdoan May 12, 2026
e320822
Merge pull request #639 from campfirein/feat/ENG-2768
danhdoan May 12, 2026
690349a
feat: [ENG-2769] brv read <path> — single-topic render command
danhdoan May 12, 2026
f88760d
Merge pull request #640 from campfirein/feat/ENG-2769
danhdoan May 12, 2026
6424987
fix: tool-mode write-time overwrite guard
RyanNg1403 May 12, 2026
0ec07d0
fix: address PR review feedback on overwrite guard
RyanNg1403 May 12, 2026
50d2fdf
Merge pull request #643 from campfirein/fix/tool-mode-overwrite-guard
danhdoan May 12, 2026
2b5f7c6
feat: [ENG-2811, ENG-2812] query tool-mode — wire contract + server-s…
cuongdo-byterover May 13, 2026
580cf3a
docs: [ENG-2814] add Query Tool Mode subsection to bundled SKILL.md
cuongdo-byterover May 13, 2026
0221595
fix: [ENG-2811, ENG-2812] address PR 646 review feedback
cuongdo-byterover May 13, 2026
5f17575
docs: [ENG-2814] mention skippedSharedCount in SKILL.md tool-mode sub…
cuongdo-byterover May 13, 2026
21c72ce
Merge pull request #646 from campfirein/feat/query-tool-mode
cuongdo-byterover May 13, 2026
f6b9e03
feat: [ENG-2815] tool mode is the default — drop BRV_*_TOOL_MODE env-…
cuongdo-byterover May 13, 2026
36bc8cd
fix: [ENG-2815] address PR 649 review — drop `as Type` casts in query.ts
cuongdo-byterover May 13, 2026
5eb1a2e
Merge pull request #649 from campfirein/feat/ENG-2815
cuongdo-byterover May 13, 2026
acef8f3
fix: file-context-file-reader extracts metadata from HTML topics (was…
danhdoan May 13, 2026
da76972
docs: [ENG-2822] scrub deprecated LLM-provider references from SKILL.md
cuongdo-byterover May 13, 2026
4447831
Merge pull request #651 from campfirein/feat/ENG-2822
cuongdo-byterover May 13, 2026
f2dcea2
fix: address review feedback on html-context-file-reader
danhdoan May 13, 2026
f8fd27b
Merge branch 'proj/byterover-tool-mode' into fix/html-context-file-re…
danhdoan May 13, 2026
398df7a
Merge pull request #650 from campfirein/fix/html-context-file-reader
danhdoan May 13, 2026
4c21539
feat: (ENG-2810) editorial topic viewer for bv-* HTML topics
wzlng May 13, 2026
597c919
refactor: move topic-viewer to byterover-packages and harden against …
wzlng May 14, 2026
fe61fcb
test: drop extract-text unit test now that helper lives in byterover-…
wzlng May 14, 2026
0504bcb
chore: bump byterover-packages
wzlng May 14, 2026
f2cd916
Merge pull request #654 from campfirein/feat/ENG-2810
wzlng May 14, 2026
24da6db
feat: [ENG-2836] MCP brv-query — migrate to query-tool-mode task type
cuongdo-byterover May 14, 2026
f92d07b
feat: [ENG-2837] MCP brv-curate — replace with curate-html-direct (br…
cuongdo-byterover May 14, 2026
b74a2b0
fix: [ENG-2837] address PR #658 review — Windows paths, strict schema…
cuongdo-byterover May 14, 2026
7f2143b
Merge pull request #657 from campfirein/feat/ENG-2840
DatPham-6996 May 15, 2026
04bc3f6
Merge pull request #658 from campfirein/feat/ENG-2837
cuongdo-byterover May 15, 2026
20c9e1c
Merge branch 'main' into proj/byterover-tool-mode
danhdoan May 15, 2026
eedb17c
fix: address PR #663 review feedback
danhdoan May 15, 2026
e72d292
fix: ENG-2847 enrich MCP brv-curate description so agent output match…
cuongdo-byterover May 17, 2026
ee46216
fix: ENG-2847 restore structural placement signal in schema slice (Ph…
cuongdo-byterover May 17, 2026
a752930
fix: ENG-2847 reconcile bv-flow with its inline-content contract
cuongdo-byterover May 17, 2026
c886b39
Merge pull request #665 from campfirein/fix/ENG-2847
cuongdo-byterover May 17, 2026
847891e
refactor: [ENG-2842] remove provider/LLM/billing surfaces from user-f…
wzlng May 17, 2026
9543033
feat: render curate-html-direct task input/output structurally
wzlng May 17, 2026
eeae6fd
fix: [ENG-2844] drop stale billing-line status tests and restore help…
wzlng May 17, 2026
4b0d7d9
fix: align curate-html-direct error shape with daemon's `kind` discri…
wzlng May 17, 2026
4ec0ba3
Merge pull request #667 from campfirein/feat/ENG-2844
wzlng May 18, 2026
792a1ab
feat: [ENG-2851] add curate response envelope to restore HITL for too…
RyanNg1403 May 18, 2026
c823827
fix: [ENG-2851] seed review-backup before destructive tool-mode curat…
RyanNg1403 May 18, 2026
7ee32ab
fix: [ENG-2851] reformat ternary, add e2e restore-on-reject guardrail…
RyanNg1403 May 18, 2026
56497a6
Merge pull request #671 from campfirein/feat/ENG-2851
cuongdo-byterover May 18, 2026
019bd3a
Merge remote-tracking branch 'origin/proj/byterover-tool-mode' into f…
DatPham-6996 May 18, 2026
f5e92f5
feat: [ENG-2697] split ByteRover skill into sub-skills, add Hermes co…
DatPham-6996 May 18, 2026
8797880
chore: sync main v3.14.0
danhdoan May 19, 2026
090a942
Merge remote-tracking branch 'origin/proj/byterover-tool-mode' into f…
DatPham-6996 May 19, 2026
eafd498
feat: [ENG-2697] add curate-judgement sub-skill, harden curate guide
DatPham-6996 May 19, 2026
6a9b256
feat: [ENG-2858] wire runtime-signal sidecar in tool-mode curate writ…
RyanNg1403 May 19, 2026
aeb5801
fix: [ENG-2858] address PR review feedback on sidecar wiring
RyanNg1403 May 19, 2026
6c5f451
fix: [ENG-2858] drop read-side sidecar wraps to avoid double-counting
RyanNg1403 May 19, 2026
88b5c99
Merge pull request #677 from campfirein/feat/ENG-2858-sidecar
danhdoan May 19, 2026
9ee724c
Merge branch 'main' into proj/byterover-tool-mode
danhdoan May 19, 2026
799349f
feat: [ENG-2858] add 4 tool-mode dream candidate generators (link, me…
RyanNg1403 May 19, 2026
f346fcd
feat: [ENG-2858] add tool-mode dream topic loader + session orchestrator
RyanNg1403 May 19, 2026
d8197ef
feat: [ENG-2858] add dream-scan/dream-finalize task types + brv dream…
RyanNg1403 May 19, 2026
bdfdcd3
Merge branch 'feat/ENG-2697-variant' into feat/ENG-2697
DatPham-6996 May 19, 2026
2cb2bf3
fix: [ENG-2858] tool-mode dream — code-quality, BM25 query, undo via …
RyanNg1403 May 19, 2026
438c954
fix: [ENG-2858] tool-mode dream CLI UX — finalize validation, SKILL.m…
RyanNg1403 May 19, 2026
c676195
fix: [ENG-2858] normalize bv-topic related refs in topic-loader
RyanNg1403 May 19, 2026
a2e79ac
fix: [ENG-2858] address PR review feedback on tool-mode dream
RyanNg1403 May 19, 2026
dcbb121
fix: [ENG-2858] address follow-up review on tool-mode dream
RyanNg1403 May 19, 2026
886c78c
Merge pull request #678 from campfirein/feat/ENG-2858
danhdoan May 20, 2026
573ef8d
fix: [ENG-2858] correct tool-mode dream candidate-action mechanism in…
RyanNg1403 May 20, 2026
4c1b9f9
Merge pull request #681 from campfirein/fix/fix-dream-in-skill
cuongdo-byterover May 20, 2026
f677d13
Merge pull request #679 from campfirein/proj/tool-mode-dreaming
danhdoan May 20, 2026
d6bd4cf
feat: [ENG-2860] context-tree index vocabulary
danhdoan May 20, 2026
735df4f
feat: [ENG-2861] context-tree index generator + regeneration hooks
danhdoan May 20, 2026
7f7d3dd
fix: [ENG-2860] address PR #682 review feedback
danhdoan May 20, 2026
ebaf3fd
Merge branch 'feat/ENG-2860' into feat/ENG-2861
danhdoan May 20, 2026
f02451e
Merge pull request #682 from campfirein/feat/ENG-2860
danhdoan May 20, 2026
79e1619
Merge branch 'proj/byterover-tool-mode' into feat/ENG-2861
danhdoan May 20, 2026
d13f0be
fix: [ENG-2861] address PR #683 review feedback
danhdoan May 20, 2026
46e13f9
Merge remote-tracking branch 'origin/feat/ENG-2861' into feat/ENG-2861
danhdoan May 20, 2026
e9a1ef0
Merge pull request #683 from campfirein/feat/ENG-2861
danhdoan May 20, 2026
1b1c810
fix: track index.html in CoGit; rename from _index.html
cuongdo-byterover May 20, 2026
3bf6f06
fix: auto-resolve spurious index.html conflict on pull/merge
cuongdo-byterover May 20, 2026
00c570b
fix: address PR #684 review — root-only match + missing test coverage
cuongdo-byterover May 20, 2026
4e84552
Merge pull request #684 from campfirein/fix/track-context-tree-index
danhdoan May 20, 2026
0b98569
Merge branch 'main' into proj/byterover-tool-mode
danhdoan May 20, 2026
125d2fe
Merge branch 'proj/byterover-tool-mode' into feat/ENG-2697
DatPham-6996 May 20, 2026
f2bbbf3
fix: [ENG-2697] sub-skill gaps — missing brv commands + examples
cuongdo-byterover May 20, 2026
cda1cd3
Revert "Merge branch 'feat/ENG-2697-variant' into feat/ENG-2697"
DatPham-6996 May 21, 2026
c3f17aa
refactor: [ENG-2880] drop legacy flags from brv curate / brv query
cuongdo-byterover May 21, 2026
c4c4a52
fix: [ENG-2880] address PR #687 review — JSON envelope, this.error, -…
cuongdo-byterover May 21, 2026
eb3add2
Merge pull request #687 from campfirein/refactor/ENG-2880
danhdoan May 21, 2026
13d83a6
refactor: [ENG-2884] remove legacy LLM-driven brv dream path
cuongdo-byterover May 21, 2026
7d77a8e
fix: [ENG-2884] address PR #689 review — wire DREAM_REMOVED_FLAGS + c…
cuongdo-byterover May 21, 2026
8d5ded0
fix: [ENG-2883] add HTML output contract rules and related-ref warner
RyanNg1403 May 21, 2026
f6ec3c2
fix: [ENG-2883] address PR #690 review — surface warnings in MCP enve…
RyanNg1403 May 21, 2026
ffe6856
fix: [ENG-2883] drop ambiguous-ref warning, address PR #690 review nits
RyanNg1403 May 21, 2026
5887e2a
fix: [ENG-2883] probe only the suffix the agent chose; address PR #69…
RyanNg1403 May 21, 2026
e02f000
Merge pull request #690 from campfirein/fix/ENG-2883
danhdoan May 21, 2026
c915ca2
Merge remote-tracking branch 'origin/proj/byterover-tool-mode' into r…
RyanNg1403 May 21, 2026
7a397ba
fix: [ENG-2884] strip trailing .html in topicPathToFilePath (idempote…
RyanNg1403 May 21, 2026
f5566ac
fix: [ENG-2884] add search-service refreshIndex + combineWith option;…
RyanNg1403 May 21, 2026
2e138a6
fix: [ENG-2884] disclose v1-stub status on dream sessions/cancel
RyanNg1403 May 21, 2026
53004fd
docs: [ENG-2884] expand SKILL.md §7 with sample envelopes, thresholds…
RyanNg1403 May 21, 2026
8c7c1cc
fix: [ENG-2884] await in-flight build in refreshIndex (race fix on f5…
RyanNg1403 May 21, 2026
e3f96e8
fix: [ENG-2884] address PR #689 codex review
RyanNg1403 May 21, 2026
8edf54a
Merge pull request #689 from campfirein/refactor/ENG-2884
danhdoan May 22, 2026
cb2cd04
feat: [ENG-2536] add ByteRover onboarding tour skill
wzlng May 23, 2026
5f1b676
feat: [ENG-2885] adopt callback-based topic-viewer in webui
ncnthien May 24, 2026
1667415
fix: [ENG-2885] address PR #699 review nits
ncnthien May 24, 2026
ed5fd7c
Merge pull request #698 from campfirein/feat/ENG-2536
DatPham-6996 May 25, 2026
702a2a9
Merge pull request #699 from campfirein/feat/ENG-2885
ncnthien May 25, 2026
2eb391e
fix: [ENG-2925] route CLI curate through daemon so it shows in Task q…
cuongdo-byterover May 25, 2026
3faa1d2
fix: [ENG-2925] address PR #705 review + fix review-handler test
cuongdo-byterover May 25, 2026
d8d8315
feat: [ENG-2834] port migration script to TypeScript and wire brv mig…
RyanNg1403 May 25, 2026
1018a32
test: inline migrate golden fixtures, drop fixture dir + python regen…
RyanNg1403 May 25, 2026
d4327a7
Merge branch 'proj/byterover-tool-mode' into feat/ENG-2834-port-to-ts
RyanNg1403 May 25, 2026
af026d4
fix: address PR #706 review — stdout rollback preview, clean no-archi…
RyanNg1403 May 25, 2026
acd93d4
fix: address deferred PR #706 review — refuse same-day re-run, skip h…
RyanNg1403 May 25, 2026
4b68f18
Merge pull request #706 from campfirein/feat/ENG-2834-port-to-ts
danhdoan May 25, 2026
0b1b1b2
Merge branch 'main' (3.16.0) into chore/byterover-tool-mode-sync-3.16
danhdoan May 25, 2026
102d589
refactor: [ENG-2925] rename `curate-html-direct` task type to `curate…
cuongdo-byterover May 25, 2026
3ce063f
Merge branch 'proj/byterover-tool-mode' into fix/ENG-2925
cuongdo-byterover May 25, 2026
2baf272
feat: [ENG-2697] surface vc/sync/cross-agent controls in onboarding tour
DatPham-6996 May 26, 2026
8bc8bc6
Merge branch 'proj/byterover-tool-mode' into fix/ENG-2925
cuongdo-byterover May 26, 2026
1eafbc4
test: add cancelQueuedTask stub to IAgentPool fixture
cuongdo-byterover May 26, 2026
30bc4f0
Merge pull request #705 from campfirein/fix/ENG-2925
danhdoan May 26, 2026
88a41d5
feat: add VC-sync hint after successful migrate
RyanNg1403 May 26, 2026
2b6607c
Merge branch 'proj/byterover-tool-mode' into feat/add-migration-hint
RyanNg1403 May 26, 2026
be740ea
fix: tighten VC-sync hint gate and extract testable helper
RyanNg1403 May 26, 2026
910d4d5
Merge pull request #708 from campfirein/feat/add-migration-hint
RyanNg1403 May 26, 2026
6733e84
docs: [ENG-2697] correct dream.md sub-skill to match codebase
RyanNg1403 May 27, 2026
2eec288
Merge branch 'proj/byterover-tool-mode' into feat/ENG-2697
DatPham-6996 May 27, 2026
b49d341
fix: preserve malformed YAML configs during MCP install
DatPham-6996 May 27, 2026
34e5594
Merge pull request #675 from campfirein/feat/ENG-2697
cuongdo-byterover May 27, 2026
dd56e2c
docs(skill): align curate guidance across templates
DatPham-6996 May 27, 2026
11adb44
Merge branch 'proj/byterover-tool-mode' into feat/ENG-2697
DatPham-6996 May 27, 2026
79a2dbf
Merge pull request #717 from campfirein/feat/ENG-2697
DatPham-6996 May 27, 2026
ba1863b
docs(skill): clarify curate completion and review guidance
DatPham-6996 May 27, 2026
a768dbb
Merge branch 'proj/byterover-tool-mode' into feat/ENG-2697
DatPham-6996 May 27, 2026
c9c7614
Update task
DatPham-6996 May 27, 2026
533bb0a
Correct history
DatPham-6996 May 27, 2026
85cc6ab
Correct history
DatPham-6996 May 27, 2026
90a6ba7
Merge branch 'main' into proj/byterover-tool-mode
danhdoan May 27, 2026
b1273fb
Merge remote-tracking branch 'origin/proj/byterover-tool-mode' into f…
DatPham-6996 May 27, 2026
930656c
Merge pull request #723 from campfirein/feat/ENG-2697
DatPham-6996 May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
177 changes: 177 additions & 0 deletions docs/curate-protocol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# `brv curate` tool-mode session protocol

The session protocol lets a calling agent (Claude Code, Cursor, etc.) drive `brv curate` without byterover holding any LLM provider config. ByteRover orchestrates the multi-step flow; the calling agent supplies LLM completions across multiple CLI invocations.

This document defines the wire contract: CLI surface, JSON envelope, lifecycle. SKILL.md authors and other tool consumers key off the shapes documented here.

## CLI surface

### Kickoff

```bash
brv curate "<user intent>" --format json
```

Tool mode is the only path for `brv curate` — no provider configuration, no env-var opt-in.

### Continuation — `--session` carries the prior call's id

```bash
brv curate --session <sessionId> --response "<calling agent's output>" --format json
```

Presence of `--session` resumes an in-flight session created by a prior kickoff.

### Overwrite intent — `--overwrite` on continuation

```bash
brv curate --session <sessionId> --response "<calling agent's output>" --overwrite --format json
```

Default behavior: the writer refuses to clobber an existing topic at the resolved path and returns a `path-exists` correction step carrying the prior file's content. Pass `--overwrite` only when the calling agent has consciously decided to replace prior content. The flag is consumed on the continuation it appears on; subsequent continuations in the same session must repeat it if they still want to overwrite.

### `--format text` fallback

Both kickoff and continuation accept `--format text` for shell users. The output is a terse human digest. The primary consumer (the calling agent) uses `--format json`.

## Wire envelope

Every kickoff and continuation call returns the same JSON envelope under the standard CLI wrapper:

```json
{
"command": "curate",
"success": <ok>,
"data": {
"ok": <bool>,
"status": "done" | "needs-llm-step" | "failed",
"sessionId": "<uuid>", // present on needs-llm-step AND on transient failed (see below)
"step": "generate-html" | "correct-html",
"prompt": "<free-text>", // free-text instruction for the calling agent's LLM
"schema": { ... }, // optional per-step schema slice
"errors": [ // present on correct-html and on failed
{
"kind": "<machine-readable>",
"tag": "<bv-element>?",
"attribute": "<attribute-name>?",
"message": "<human-readable>"
}
],
"filePath": "<relative-path>" // relative to .brv/context-tree/; present when status = done
},
"timestamp": "<iso>"
}
```

### Status values

| `status` | Meaning | Next action for calling agent |
|---|---|---|
| `needs-llm-step` | Byterover wants an LLM completion. `prompt` + `step` describe what. | Run the calling agent's own LLM on `prompt`, then `brv curate --session <sessionId> --response "<output>"`. |
| `done` | Curate complete. `filePath` is the location of the written topic. | Report success to user. Session is cleaned up. |
| `failed` | Terminal error. `errors[]` explains why. | Report failure to user; abandon session. |

### `step` values (when `status === 'needs-llm-step'`)

| `step` | Meaning | Expected `--response` payload |
|---|---|---|
| `generate-html` | First call asking the calling agent to author a `<bv-topic>` document. | The generated HTML. |
| `correct-html` | A previous response failed validation. `errors[]` enumerates what to fix. | Corrected HTML. |

### Error `kind` values

| `kind` | Lifecycle | Terminal? | Notes |
|---|---|---|---|
| `missing-content` | Kickoff | **terminal** | Kickoff invoked without a context argument; no session created |
| `missing-response` | Continuation | **terminal** | `--session` invoked without `--response`; session unaffected |
| `invalid-flag-combination` | Continuation | **terminal** | Emitted before any session lookup when a flag is used outside its supported call shape. Today the only producer is `--overwrite` passed without `--session` (legacy curate path does not honour `--overwrite`). |
| `unknown-session` | Continuation | **terminal** | Session id doesn't exist, was already completed, or fails uuid validation |
| `empty-response` | Continuation | **transient** (session kept live) | Continuation received an empty `--response`; caller retries with the same `sessionId` |
| `retry-cap-exceeded` | Continuation | **terminal** | `MAX_ATTEMPTS = 4` (1 generate + 3 corrections) reached without valid HTML; session cleared. Accompanied by the validation errors that pushed the session over the cap. |
| `missing-bv-topic` | Continuation | **transient** (correction) | Response had zero `<bv-topic>` root elements |
| `multiple-bv-topic` | Continuation | **transient** (correction) | Response had more than one `<bv-topic>` root |
| `missing-path-attribute` | Continuation | **transient** (correction) | `<bv-topic>` is missing a non-empty `path` attribute |
| `unsafe-path` | Continuation | **transient** (correction) | `<bv-topic path>` contains `..` or `.` segments |
| `unknown-element` | Continuation | **transient** (correction) | Response contains a `<bv-*>` tag outside the closed registry; `tag` field carries the offending name |
| `attribute-validation` | Continuation | **transient** (correction) | An element's attributes failed its registered validator. `tag` carries the element, `attribute` the offending field. |
| `path-exists` | Continuation | **transient** (correction) | A topic already exists at the resolved path and `--overwrite` was not passed. The envelope error carries `existingContent` (the prior file's bytes); the correction prompt inlines the same content inside an `<existing-topic path="…">…</existing-topic>` block so the calling agent can merge new content into existing structure. The guard does not clear by re-emitting different content — `--overwrite` is required to write at this path. Default workflow: merge `existingContent` with the new content and re-emit with `--overwrite`. Alternative: choose a different `<bv-topic path>` (no `--overwrite` needed). |

**Terminal vs transient.** Terminal failures end the session — the caller cannot retry the same `sessionId` and must start a new kickoff. Transient failures keep the session alive on disk; the envelope echoes the `sessionId` back and the caller is expected to issue a corrected continuation against it.

**Retry cap.** Each transient correction increments an internal `attempts` counter on the session. After `MAX_ATTEMPTS = 4` consecutive invalid responses (the initial generate plus three corrections) the orchestrator terminates with `retry-cap-exceeded` and clears the session. Calling agents should surface this as "I couldn't produce valid HTML after several attempts; want to try a different framing?".

Calling agents should switch on `kind`, fall back gracefully on unknown kinds, and surface the `message` text to the user.

## Lifecycle — worked example

A complete tool-mode curate session, end-to-end:

### 1. Kickoff

```bash
brv curate "remember we decided to use RS256" --format json
```

Response (placeholder):

```json
{
"command": "curate",
"success": true,
"data": {
"ok": true,
"status": "needs-llm-step",
"sessionId": "8c3f9e2a-...",
"step": "generate-html",
"prompt": "Generate a <bv-topic>...</bv-topic> HTML document for the following user intent:\n\nremember we decided to use RS256\n\n..."
},
"timestamp": "2026-05-11T12:00:00.000Z"
}
```

### 2. Calling agent's LLM produces HTML

```html
<bv-topic path="security/auth" title="JWT signing algorithm">
<bv-decision id="d-rs256">Use RS256 over HS256.</bv-decision>
</bv-topic>
```

### 3. Continuation

```bash
brv curate --session 8c3f9e2a-... --response "<bv-topic ...>...</bv-topic>" --format json
```

Response on a valid HTML topic:

```json
{
"command": "curate",
"success": true,
"data": {
"ok": true,
"status": "done",
"filePath": "security/auth.html"
},
"timestamp": "2026-05-11T12:00:01.000Z"
}
```

If validation fails (e.g. the agent forgot `path=` on `<bv-topic>`), the envelope instead carries `status: "needs-llm-step"`, `step: "correct-html"`, and `errors[]` for the calling agent to fix. Up to 3 corrections (MAX_ATTEMPTS = 4 total) before terminal `status: "failed"` with `kind: retry-cap-exceeded`.

## Session storage

CLI-side. Per-project, on disk at `<projectRoot>/.brv/sessions/curate-<sessionId>/state.json`. State carries `attempts`, `step` (`awaiting-generate` vs `awaiting-correct`), and the last response (for the correction prompt). State is removed when the session reaches terminal `done` or terminal `failed` (including `retry-cap-exceeded`).

Abandoned sessions are not yet pruned — a 1-hour TTL is a planned follow-up that pairs with moving state into the daemon's existing task-session lifecycle.

## Stability promise

SKILL.md ships against this envelope, so renaming any key here is a breaking change. New error kinds and new step values can be added without breaking existing consumers — calling agents are expected to gracefully ignore unknown values.

## What's not the protocol's job

- **HTML generation.** Calling agent's LLM authors the HTML per the `prompt`. Byterover never touches an LLM in tool mode.
- **Schema knowledge.** Embedded in the `prompt` (the prompt builder condenses the bv-* spec). Calling agent doesn't pre-load any schema.
- **Retry strategy beyond the protocol's correct-html loop.** If the calling agent's LLM keeps producing invalid HTML for 3 rounds, the session terminates `failed` — the calling agent surfaces this and falls back to asking the user for clarification.
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)),

export default [
includeIgnoreFile(gitignorePath),
// The byterover-packages submodule has its own ESLint config and tsconfig
// (referencing @workspace/* packages) — skip it from the root lint run.
{ignores: ['packages/**']},
...oclif,
prettier,
{
Expand Down
Loading
Loading