Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- **A subagent card's report is described as lich's envelope.** The note the
Agent call answers with, in every prompt language, says the worker's report
arrives at the prompt by itself as a `<lich-notification kind="worker-finished">`,
the envelope lich hands every note in, so there is nothing to poll or collect.
It no longer speaks of a `[lich]` note, which lich no longer sends. Needs the
lich release after v0.92.0, the first that sends the notification envelope;
this release is a minor so that an older lich, still sending `[lich]` notes,
never installs it.

## [0.21.1] - 2026-11-13

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ a lich session: a card you can watch and steer, working in the asking session's
checkout as a native subagent does, or in a worktree of its own when the
subagent asks for isolation. The Agent call returns at once as a background
subagent, and the session's full report arrives at the asking session's prompt
on its own as a `[lich]` note: the worker's last message is its report, as a native subagent's is
on its own as a `<lich-notification kind="worker-finished">`: the worker's last message is its report, as a native subagent's is
([docs/mod-answer.md](docs/mod-answer.md)). Explore, Plan and other agent types stay inside Claude Code. [docs/agent-cards.md](docs/agent-cards.md) has the
rules and what happens when lich cannot be reached. Since that subagent shares
the checkout, an edit to a file another lich session edited in the last ten
Expand Down
8 changes: 4 additions & 4 deletions docs/agent-cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Nothing runs after that: the delivery `lich open` printed decides the answer.
|-------------------------------|---------------------------------------------------------------------|
| `pending` | `async_launched` at once, plus a note on how the report comes back; the worker is counted in the footer |
| `answered` | `completed`: the report, then the checkout (and branch) it is on |
| `unanswered` | `async_launched`, as for `pending`: a turn that ended unanswered usually left a background command running, and the report still arrives as a [lich] note |
| `unanswered` | `async_launched`, as for `pending`: a turn that ended unanswered usually left a background command running, and the report still arrives as a `<lich-notification kind="worker-finished">` |
| `unread`, `undelivered` | denied: the task never reached the card |
| a status it does not know | denied, naming the card and its branch |
| the open failed | the native agent runs, with a toast saying why |
Expand Down Expand Up @@ -104,8 +104,8 @@ for an isolated call.
has the task it answers `async_launched` and the asking turn goes on. Parallel
Agent calls run their hooks concurrently, so each opens its own card at once.
- **The report comes back through lich, not Claude Code.** `--subagent` makes
lich type the worker's whole report at the asking session's prompt as a
`[lich]` note (through mod-control's `prompt` when the session runs the mod),
lich hand the worker's whole report to the asking session's prompt as a
`<lich-notification kind="worker-finished">` (through mod-control's `prompt` when the session runs the mod),
so the model has nothing to collect; `wait_for_answer` and `lich wait` still
work. Claude Code's own text for a background agent promises a task
notification and names `SendMessage`, so the result carries a `context` line
Expand All @@ -125,7 +125,7 @@ for an isolated call.
natively with a toast saying why, naming the card when one was opened. Esc
while the open is still running denies the call instead, because lich may
already have handed the task over and a native agent beside the worker would
do the work twice; a report that worker sends still arrives as a `[lich]` note.
do the work twice; a report that worker sends still arrives as a `<lich-notification kind="worker-finished">`.
- **An isolated worker's branch is named from the call.** The description is slugged the way
lich's own worktree dialog slugs a typed name (2 to 5 words, 10 to 40
characters, letters and digits in any script), `agent` when nothing is left,
Expand Down
5 changes: 3 additions & 2 deletions hooks/agent-cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
//
// Once lich has the task the Agent call answers at once, as a background
// subagent does, and nothing here waits on the worker: `--subagent` makes lich
// type the worker's whole report at this session's prompt as a [lich] note.
// hand the worker's whole report to this session's prompt as a <lich-notification kind="worker-finished">
// envelope.
// While workers run, the status line counts them from `$LICH_BIN sessions
// --json`, and Claude Code's TaskStop on one is taken here and done by lich.
//
Expand Down Expand Up @@ -261,7 +262,7 @@ function answerFor(e, opened, branch, report, durationMs, lang) {
switch (report.status) {
// A worker whose turn ended unanswered is usually still at it: it left a
// command running in the background and resumes when it finishes, and its
// report still arrives as a [lich] note.
// report still arrives as a <lich-notification kind="worker-finished">.
case "pending":
case "unanswered":
return backgrounded(e, opened, branch, lang)
Expand Down
44 changes: 22 additions & 22 deletions hooks/prompt-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// session as LICH_PROMPT_LANG (`internal/prompt` there); an empty or unknown
// value is English, as it is for lich itself.
//
// A text is a template with `{name}` slots. Tool and command names, the `[lich]`
// marker and the status enums are literal in every locale: the model matches on
// A text is a template with `{name}` slots. Tool and command names, the
// `<lich-notification` tag with its attribute and kind names, and the status enums are literal in every locale: the model matches on
// them, and so does the contract.

/** @type {Record<string, string>} */
Expand All @@ -19,8 +19,8 @@ export const en = {
whereShared: "in this same checkout, {path}, and edits its files as you do",
backgrounded:
'The agent runs as the lich session "{label}", {where}. ' +
"Its full report arrives at this prompt on its own as a [lich] note, not as a task notification, so there " +
"is no need to call wait_for_answer (it still works). SendMessage cannot reach that session; " +
'Its full report arrives at this prompt by itself as a <lich-notification kind="worker-finished">, so there is no need to poll ' +
"or to call wait_for_answer (it still works). SendMessage cannot reach that session; " +
"send_to_session or lich send can.",
completedBranch:
'The work is on branch {branch} in {path} (lich session "{label}"), not in this checkout. ' +
Expand All @@ -31,7 +31,7 @@ export const en = {
denyNeverReached: 'the task never reached "{label}" ({status}): open its card.',
denyAnswered: 'lich answered "{status}" about "{label}"{branchPart}: open its card.',
denyInterrupted:
"interrupted; a lich session{branchPart} may already have the task, and a report it sends arrives here as a [lich] note.",
'interrupted; a lich session{branchPart} may already have the task, and a report it sends arrives here as a <lich-notification kind="worker-finished">.',
denyStopFailed: 'lich could not stop "{label}": {reason}',
lichExited: "lich exited {code}",
editNoteJustNow: "under a minute ago",
Expand Down Expand Up @@ -65,8 +65,8 @@ export const ptBR = {
whereShared: "neste mesmo checkout, {path}, e edita os arquivos dele como você",
backgrounded:
'O agente roda como a sessão lich "{label}", {where}. ' +
"O relatório completo chega neste prompt por conta própria como uma nota [lich], não como task notification, " +
"então não é preciso chamar wait_for_answer (ele ainda funciona). SendMessage não alcança essa sessão; " +
'O relatório completo chega neste prompt por conta própria como um <lich-notification kind="worker-finished">, então não é preciso ' +
"fazer polling nem chamar wait_for_answer (ele ainda funciona). SendMessage não alcança essa sessão; " +
"send_to_session ou lich send alcançam.",
completedBranch:
'O trabalho está na branch {branch} em {path} (sessão lich "{label}"), não neste checkout. ' +
Expand All @@ -77,7 +77,7 @@ export const ptBR = {
denyNeverReached: 'a tarefa nunca chegou a "{label}" ({status}): abra o card dela.',
denyAnswered: 'o lich respondeu "{status}" sobre "{label}"{branchPart}: abra o card dela.',
denyInterrupted:
"interrompido; uma sessão lich{branchPart} pode já ter a tarefa, e o relatório que ela enviar chega aqui como nota [lich].",
'interrompido; uma sessão lich{branchPart} pode já ter a tarefa, e o relatório que ela enviar chega aqui como um <lich-notification kind="worker-finished">.',
denyStopFailed: 'o lich não conseguiu parar "{label}": {reason}',
lichExited: "o lich saiu com {code}",
editNoteJustNow: "há menos de um minuto",
Expand Down Expand Up @@ -109,7 +109,7 @@ export const zhCN = {
whereShared: "在同一个 checkout {path} 中,并且和你一样编辑其中的文件",
backgrounded:
'agent 作为 lich 会话 "{label}" 运行,{where}。' +
"它的完整报告会作为 [lich] 备注自动出现在此提示中,而不是 task notification,因此无需调用 " +
'它的完整报告会以 <lich-notification kind="worker-finished"> 的形式自动出现在此提示中,因此无需轮询,也无需调用 ' +
"wait_for_answer(调用仍然有效)。SendMessage 无法联系该会话;send_to_session 或 lich send 可以。",
completedBranch:
'工作位于分支 {branch} 上的 {path}(lich 会话 "{label}"),不在当前 checkout 里。' +
Expand All @@ -120,7 +120,7 @@ export const zhCN = {
denyNeverReached: '任务从未送达 "{label}"({status}):请打开它的卡片。',
denyAnswered: 'lich 针对 "{label}"{branchPart} 返回了 "{status}":请打开它的卡片。',
denyInterrupted:
"已中断;某个 lich 会话{branchPart}可能已经拿到任务,它发送的报告会作为 [lich] 备注出现在这里。",
'已中断;某个 lich 会话{branchPart}可能已经拿到任务,它发送的报告会以 <lich-notification kind="worker-finished"> 的形式出现在这里。',
denyStopFailed: 'lich 无法停止 "{label}":{reason}',
lichExited: "lich 退出,退出码 {code}",
editNoteJustNow: "不到一分钟前",
Expand Down Expand Up @@ -153,8 +153,8 @@ export const es = {
whereShared: "en este mismo checkout, {path}, y edita sus archivos igual que tú",
backgrounded:
'El agente se ejecuta como la sesión lich "{label}", {where}. ' +
"Su informe completo llega a este prompt por sí solo como una nota [lich], no como task notification, así que no " +
"hace falta llamar a wait_for_answer (sigue funcionando). SendMessage no puede llegar a esa sesión; " +
'Su informe completo llega a este prompt por sí solo como un <lich-notification kind="worker-finished">, así que no hace falta ' +
"hacer polling ni llamar a wait_for_answer (sigue funcionando). SendMessage no puede llegar a esa sesión; " +
"send_to_session o lich send sí.",
completedBranch:
'El trabajo está en la rama {branch} en {path} (sesión lich "{label}"), no en este checkout. ' +
Expand All @@ -165,7 +165,7 @@ export const es = {
denyNeverReached: 'la tarea nunca llegó a "{label}" ({status}): abre su tarjeta.',
denyAnswered: 'lich respondió "{status}" sobre "{label}"{branchPart}: abre su tarjeta.',
denyInterrupted:
"interrumpido; puede que una sesión lich{branchPart} ya tenga la tarea, y el informe que envíe llega aquí como una nota [lich].",
'interrumpido; puede que una sesión lich{branchPart} ya tenga la tarea, y el informe que envíe llega aquí como un <lich-notification kind="worker-finished">.',
denyStopFailed: 'lich no pudo detener "{label}": {reason}',
lichExited: "lich terminó con {code}",
editNoteJustNow: "hace menos de un minuto",
Expand Down Expand Up @@ -198,8 +198,8 @@ export const ja = {
whereShared: "同じこのチェックアウト {path} で、あなたと同じようにそのファイルを編集します",
backgrounded:
'エージェントは lich セッション "{label}" として動いています({where})。' +
"そのレポート全体は、task notification ではなく [lich] の通知として、このプロンプトに自動で届きます。" +
"そのため wait_for_answer を呼ぶ必要はありません(呼んでも動作します)。SendMessage ではそのセッションに届きません。" +
'そのレポート全体は <lich-notification kind="worker-finished"> として、このプロンプトに自動で届きます。' +
"そのためポーリングも wait_for_answer の呼び出しも必要ありません(呼んでも動作します)。SendMessage ではそのセッションに届きません。" +
"send_to_session または lich send なら届きます。",
completedBranch:
'作業はブランチ {branch} の {path} にあり(lich セッション "{label}")、このチェックアウトにはありません。' +
Expand All @@ -211,7 +211,7 @@ export const ja = {
denyAnswered: 'lich は "{label}"{branchPart} について "{status}" と答えました:そのカードを開いてください。',
denyInterrupted:
"中断されました。lich セッション{branchPart}がすでにタスクを受け取っている可能性があり、" +
"そのセッションが送るレポートは [lich] の通知としてここに届きます。",
'そのセッションが送るレポートは <lich-notification kind="worker-finished"> としてここに届きます。',
denyStopFailed: 'lich は "{label}" を停止できませんでした:{reason}',
lichExited: "lich が終了コード {code} で終了しました",
editNoteJustNow: "1 分以内",
Expand Down Expand Up @@ -244,8 +244,8 @@ export const ko = {
whereShared: "같은 체크아웃 {path}, 당신처럼 그 파일을 수정함",
backgrounded:
'에이전트는 lich 세션 "{label}"에서 실행됩니다({where}). ' +
"전체 보고서는 task notification이 아니라 [lich] 메모로 이 프롬프트에 알아서 도착하므로, " +
"wait_for_answer를 호출할 필요가 없습니다(호출해도 동작합니다). SendMessage로는 그 세션에 닿을 수 없고, " +
'전체 보고서는 <lich-notification kind="worker-finished">로 이 프롬프트에 알아서 도착하므로, ' +
"폴링하거나 wait_for_answer를 호출할 필요가 없습니다(호출해도 동작합니다). SendMessage로는 그 세션에 닿을 수 없고, " +
"send_to_session이나 lich send로는 닿을 수 있습니다.",
completedBranch:
'작업은 브랜치 {branch}의 {path}에 있으며(lich 세션 "{label}"), 이 체크아웃에는 없습니다. ' +
Expand All @@ -256,7 +256,7 @@ export const ko = {
denyNeverReached: '작업이 "{label}"에 한 번도 전달되지 않았습니다({status}): 그 카드를 열어 보세요.',
denyAnswered: 'lich의 답은 "{status}"였습니다("{label}"{branchPart}): 그 카드를 열어 보세요.',
denyInterrupted:
"중단되었습니다. 작업이 이미 lich 세션{branchPart}에 있을 수 있으며, 그 세션이 보내는 보고서는 [lich] 메모로 여기에 도착합니다.",
'중단되었습니다. 작업이 이미 lich 세션{branchPart}에 있을 수 있으며, 그 세션이 보내는 보고서는 <lich-notification kind="worker-finished">로 여기에 도착합니다.',
denyStopFailed: 'lich가 "{label}"을(를) 멈추지 못했습니다: {reason}',
lichExited: "lich 종료 코드 {code}",
editNoteJustNow: "1분 이내",
Expand Down Expand Up @@ -289,8 +289,8 @@ export const ru = {
whereShared: "в этой же рабочей копии, {path}, и редактирует её файлы так же, как вы",
backgrounded:
'Агент работает как сессия lich "{label}", {where}. ' +
"Его полный отчёт сам придёт в этот промпт как заметка [lich], а не как task notification, поэтому " +
"вызывать wait_for_answer не нужно (он по-прежнему работает). SendMessage не может связаться с этой сессией; " +
'Его полный отчёт сам придёт в этот промпт как <lich-notification kind="worker-finished">, поэтому не нужно ни опрашивать, ' +
"ни вызывать wait_for_answer (он по-прежнему работает). SendMessage не может связаться с этой сессией; " +
"send_to_session или lich send могут.",
completedBranch:
'Работа находится в ветке {branch} в {path} (сессия lich "{label}"), а не в этой рабочей копии. ' +
Expand All @@ -301,7 +301,7 @@ export const ru = {
denyNeverReached: 'задача так и не дошла до "{label}" ({status}): откройте её карточку.',
denyAnswered: 'lich ответил "{status}" для "{label}"{branchPart}: откройте её карточку.',
denyInterrupted:
"прервано; задача, возможно, уже у сессии lich{branchPart}, и отчёт, который она отправит, придёт сюда как заметка [lich].",
'прервано; задача, возможно, уже у сессии lich{branchPart}, и отчёт, который она отправит, придёт сюда как <lich-notification kind="worker-finished">.',
denyStopFailed: 'lich не смог остановить "{label}": {reason}',
lichExited: "lich завершился с кодом {code}",
editNoteJustNow: "меньше минуты назад",
Expand Down
10 changes: 5 additions & 5 deletions tests/agent-cards.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ function completed(text, { durationMs = 3000, prompt = AGENT.prompt, worker = OP
}

const reportArrives =
'Its full report arrives at this prompt on its own as a [lich] note, not as a task notification, so there ' +
'is no need to call wait_for_answer (it still works). SendMessage cannot reach that session; ' +
'Its full report arrives at this prompt by itself as a <lich-notification kind="worker-finished">, so there is no need to poll ' +
'or to call wait_for_answer (it still works). SendMessage cannot reach that session; ' +
'send_to_session or lich send can.'

function backgrounded({ worker = OPENED } = {}) {
Expand Down Expand Up @@ -425,7 +425,7 @@ test('an isolated task still pending at the open says which branch the worker is

// A worker whose turn ended before it reported is usually still working: it
// left a command running in the background and resumes when it finishes. Its
// report still arrives as a [lich] note, so the call is a backgrounded agent,
// report still arrives as a <lich-notification kind="worker-finished">, so the call is a backgrounded agent,
// never a finished one.
test('a worker that ended its turn without reporting comes back as a backgrounded agent', async () => {
const { answer, passed } = await delegate([exits(3, openedHere('unanswered'))])
Expand Down Expand Up @@ -502,12 +502,12 @@ test('an open the user interrupted is denied, never run natively', async () => {
assert.deepEqual(passed, [])
assert.deepEqual(mod.toasts, [])
assert.deepEqual(answer, {
deny: 'interrupted; a lich session may already have the task, and a report it sends arrives here as a [lich] note.',
deny: 'interrupted; a lich session may already have the task, and a report it sends arrives here as a <lich-notification kind="worker-finished">.',
})
const isolated = interrupted()
const onItsBranch = await delegate([onBranch('main'), isolated.run], ISOLATED, { signal: isolated.signal })
assert.deepEqual(onItsBranch.answer, {
deny: `interrupted; a lich session on branch ${BRANCH} may already have the task, and a report it sends arrives here as a [lich] note.`,
deny: `interrupted; a lich session on branch ${BRANCH} may already have the task, and a report it sends arrives here as a <lich-notification kind="worker-finished">.`,
})
})

Expand Down
Loading
Loading