Skip to content

feat(agent-cards): let a lich worker open cards of its own - #58

Merged
omartelo merged 2 commits into
mainfrom
feat/nested-subagent-cards
Oct 9, 2026
Merged

omartelo merged 2 commits into
mainfrom
feat/nested-subagent-cards

Conversation

@omartelo

@omartelo omartelo commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Client side of lichdotdev/lich#690, which nests subagent cards one level down and splits the two meanings LICH_SUBAGENT_CARDS=off used to carry.

Contract (canonical in lich docs/hooks/README.md, Shared transport)

  • LICH_SUBAGENT_DEPTH is set on every Claude Code session lich starts: 0 at the top, n for a worker n --subagent levels down.
  • LICH_SUBAGENT_CARDS=off now means only "leave this session's subagents native": the setting is off, the worker is at lich's depth limit, or the installed plugin predates this release.

Changes

  • hooks/worker-answer.js: a session is a worker when LICH_SUBAGENT_DEPTH is an integer above 0. Without the variable (an older lich) it falls back to LICH_SUBAGENT_CARDS === "off", as before. A top-level session with cards turned off no longer posts answers lich would ignore.
  • hooks/agent-cards.js:
    • off with a depth above 0 runs the call natively through runNatively, so a toast says why. A top-level session with cards off stays silent, as before.
    • The subagent/ branch gate applies only when the depth is absent; with it, lich's LICH_SUBAGENT_CARDS is the only gate.
  • Docs: docs/agent-cards.md, docs/mod-answer.md, docs/providers.md (which also said only agent-cards read the variables; worker-answer did too). CHANGELOG under Changed.
  • Tests: +4 worker-answer, +3 agent-cards, +1 engine test for each. Existing tests unchanged.

Release

lich#690 sets NestedSubagentCardsRelease = "0.19.0", the contract minor #57 opened for compacting. This PR has to be in 0.19.0: a 0.19.0 without it would get nested cards switched on by that lich and never answer for the workers that open them. No version bumped here.

Tests

  • node --test tests/*.test.mjs: 363 pass, 0 fail.
  • claude plugin test .: 29 pass, 0 fail.
  • The new tests fail against the old hooks; the legacy ones pass.

lich now sets LICH_SUBAGENT_DEPTH on every Claude Code session it starts
(0 at the top, n for a worker n --subagent levels down) and keeps
LICH_SUBAGENT_CARDS=off only for the user's setting and for a worker at
its own depth limit.

- worker-answer: a session is a worker when LICH_SUBAGENT_DEPTH is an
  integer above 0; without the variable, LICH_SUBAGENT_CARDS=off still
  marks one, for an older lich.
- agent-cards: cards off in a worker (depth above 0) runs the native
  agent with a toast saying why; a top-level session stays silent. The
  subagent/ branch gate applies only without the depth variable, so a
  worker below lich's limit opens cards from an isolated worktree too.

No existing test changed; new ones cover the depth rules and the legacy
fallbacks.
… worker native

The text named the depth limit, but lich also keeps a worker native when
the user turned subagent cards off. The test pins the toast's wording, which
is what changed.
@omartelo
omartelo merged commit 5209cf3 into main Oct 9, 2026
3 checks passed
@omartelo omartelo mentioned this pull request Oct 9, 2026
@omartelo
omartelo deleted the feat/nested-subagent-cards branch October 9, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant