Skip to content

feat(benchmark): give an arm a clone that deploys the team's recall - #1728

Merged
SaulMoro merged 4 commits into
Tencent:mainfrom
Walternater:feat/benchmark-arm-recall
Nov 5, 2026
Merged

SaulMoro merged 4 commits into
Tencent:mainfrom
Walternater:feat/benchmark-arm-recall

Conversation

@Walternater

@Walternater Walternater commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What

A benchmark arm may now set recall: true, and its trial clones get the team's recall deployment.

  • ArmValuesSchema keeps its keys; ArmFileSchema gains recall?: boolean.
  • It reaches CloneTeam as an optional field and installTeam reads it in place of the hard-coded recallEnabled: false.
  • Every other workflow clone is unchanged: the field is absent, and team.recall ?? false is what it always was.

Why

src/workflow/place/clone.ts has always set recallEnabled: false for a workflow clone, which is right — it adds files a step did not ask for.

It is wrong for a benchmark measuring declared relations. Recall is the only path a relation takes to a session: docs, learnings and wiki are never written into a tool's own directory, and the relation graph stays in the team clone. Without recall on, the two arms of the suite #1564 describes would differ only in the related: text a tool receives unchanged, and the measurement could not be run at all.

Before this change src/benchmark/ did not mention recall anywhere, so #1564 — the number #1552 promises — had no way to be measured.

Not a matrix key

recall is the measurement's control, not a value the page compares one arm over, so it is deliberately outside ArmValuesSchema. changedKeys still ignores it, and a suite cannot cross it into a comparison that would mean nothing. The tests show both sides: a suite whose arms differ only in recall is refused like any two arms that change no defaults key.

Verification

vitest run src/__tests__/benchmark-plan.test.ts src/__tests__/benchmark-suite.test.ts src/__tests__/workflow-clone-place.test.ts — 176 passed.

The new plan case reads the run's own step definition:

recall: true  → {"clone":{…,"team":{…,"treatment":"pulled","recall":true}}}
no recall     → {"clone":{…,"team":{…,"treatment":"pulled"}}}

Without the fixture change the first is undefined, which is how the gap surfaced: the test helper rebuilds each planned arm field by field and was dropping recall the same way cloneTeamOf would have.

npm run typecheck and npm run lint pass.

Limitations

Refs #1564

🤖 Generated with Claude Code

Real-CLI verification at 4bacfa3 (added by a reviewer)

Built the head (npm ci && npm run build) and ran npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/benchmark-recall.test.ts, which runs teamai benchmark run fix with the built CLI and a fake Claude tool that records the files of each trial's clone: 1 passed.

The .claude/ files the two trial clones held:

with-recall: agents/teamai-recall.md, rules/teamai-context.md, rules/teamai-recall.md,
             settings.local.json, skills/teamai, skills/teamai-session-to-task,
             skills/teamai-share-learnings, skills/teamai-share-session
baseline:    settings.local.json, skills/teamai, skills/teamai-session-to-task,
             skills/teamai-share-session

The recall agent and both recall rules reach only the clone of the arm with recall: true.

A workflow clone has always turned recall off: it adds files a step did not
ask for. A benchmark arm that measures declared relations needs it on, because
recall is the only path a relation takes to a session — without it the arms
would differ only in the `related:` text a tool receives unchanged, and the
measurement Tencent#1564 describes cannot be run at all.

An arm may now set `recall: true`. It reaches `CloneTeam` as an optional
field, which `installTeam` reads in place of the hard-coded `false`; every
other workflow clone keeps its behaviour because the field is absent and
`team.recall ?? false` is what it always was.

It is deliberately not a matrix key: it is the measurement's control, not a
value the page compares one arm over, so `changedKeys` still ignores it and a
suite cannot cross it into a comparison that would mean nothing.

Refs Tencent#1564

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
  • [P1 blocking] Missing real-CLI verification record — PR description, “Verification”; runtime change at src/workflow/place/clone.ts:601. The description records unit tests, typecheck, and lint, but no end-to-end / real-CLI run. This violates the first Code Review Rules item requiring that record for runtime changes. After building, run one representative benchmark with recall: true, verify recall is deployed in its trial clone, and document the command and result.

No other confident findings in the scoped diff. Nothing from the PR was run, built, or installed.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

The wiring makes sense. recall goes from the arm, through PlannedArm and cloneTeamOf, into CloneTeam, and installTeam reads team.recall ?? false, so every clone that does not ask stays as it was. Keeping recall out of ArmValuesSchema keeps it out of the matrix and out of the "changes one defaults key" check, which fits its role as the measurement's control. I read the code only; I did not build or run it.

CI review. It flagged one [P1 blocking]: no real-CLI record. I agree. The tests stop at the planned step definition (workspace.clone.team.recall), and nothing shows a trial clone actually getting the team's recall deployment. A record of one teamai benchmark run with an arm recall: true would close it. It should show the files recall delivers inside the trial clone, and their absence for an arm without it.

[P2 non-blocking] recall is also a new workflow key, and no doc mentions it. CloneTeamSchema is part of ClonePlaceSchema, and src/workflow/parse.ts parses a step's workspace: { clone: … } through it. So a team's own workflow can now write team: { …, recall: true } as well as a suite arm. Neither key is in the guides. The arm key belongs in the key table and arm sections of docs/guide/benchmarks.md and docs/guide/zh-CN/benchmarks.md. docs/guide/workflow-advanced.md (and its zh-CN page) documents that workspace: { clone: { commit, repo?, team } } key by key, listing { revision, selection, treatment }, so recall needs a line there as well. Or, if teams aren't meant to write it, the parse should keep it to the benchmark's compiled steps.

[P2 non-blocking] cloneTeamOf drops its exhaustive switch. The old version ended with a never check, so a new ArmTeam kind failed to compile until it was handled. The nested ternary sends anything that is not none, pulled or ref to the without shape. Today that only compiles because paths exists on without alone. The change isn't needed for recall, since the old switch could spread recall the same way. Keeping the switch keeps the diff to the feature.

[P3 nit] recallOf in the new test casts step?.workspace to a hand-written shape. ClonePlaceSchema.safeParse would read it without the cast.

@jeff-r2026 your call on this one: it adds a suite key, and through the shared clone schema also a workflow key, for #1564's measurement.

@SaulMoro
SaulMoro requested a review from jeff-r2026 November 5, 2026 05:26
Review on Tencent#1728: the nested ternary in `cloneTeamOf` sent an unhandled
ArmTeam kind into the `without` shape, where only `paths` existing made it
compile — the exhaustive `never` check was the point, and it is back.

`recall` stays a workflow key, because the compiled benchmark steps a run
stores are read back through the same schema a team's YAML parses with, and
no narrower written-form schema can tell them apart. It is documented as
such: the arm key table and a new section in both benchmarks guides, and the
clone-place key in both workflow-advanced guides, where the reviewer asked
for a line.

The plan test reads the run's clone place through `ClonePlaceSchema` instead
of a hand-written cast.

Co-Authored-By: Claude Code <[email protected]>
@Walternater

Copy link
Copy Markdown
Collaborator Author

c7cf3cd addresses the three findings; the P1 is not closed yet.

The exhaustive switch (P2). Restored — the never branch is back, and the ternary is gone. The lint rule that pushed me toward it (no-conditional-empty-object-spread) is satisfied by building the recall key only in the branches that install a team.

The workflow key (P2). I tried to keep it benchmark-only first, with a narrower written-form schema in parse.ts, and that broke the feature: the compiled benchmark steps a run stores are read back through the same parser, so the read stripped recall from the benchmark's own steps. The test suite caught it — expected undefined to be true — which is the proof I could not have seen from the schema alone. So the key stays, and it is documented instead: the arm key table and a new "Arms that run with recall" section in benchmarks.md and its zh-CN page, and a recall: true line in the clone-place key of both workflow-advanced guides.

The cast (P3). recallOf reads the clone place through ClonePlaceSchema.parse now.

The real-CLI record (P1). Still owed. A teamai benchmark run with an arm recall: true needs a task suite against a team repo with a real agent tool on this machine, and I am preparing it; I will post the record on this PR, showing the delivered recall files in the trial clone and their absence in the arm without the flag.

npm run typecheck and npm run lint pass; 195 tests across the four touched files, 318 across the benchmark and clone suites.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
  • [P1 blocking] Missing real-CLI verification record remains unresolved — The PR description’s “Verification” section lists unit tests, typecheck, and lint, but no real-CLI run for the runtime change at src/workflow/place/clone.ts:601. This violates the first Code Review Rules item. Document one representative run after building that verifies recall: true deploys recall in a trial clone.

  • [P2 non-blocking] The new recall example is rejected by suite validation — docs/guide/benchmarks.md:201 and docs/guide/zh-CN/benchmarks.md:201 define two arms differing only in recall, which deliberately does not count toward changedKeys. As the PR description confirms, such a suite is refused. Show arms that differ in a supported comparison key, with recall enabled on both when measuring declared relations.

Nothing from the PR was run, built, or installed.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Thanks for the round. c7cf3cd closes the three earlier findings:

  • cloneTeamOf is a switch again with the never branch, and asked adds recall without touching the none shape.
  • The arm key is in the key table and has its own section in docs/guide/benchmarks.md and the zh-CN page, and the workspace: { clone } paragraph in docs/guide/workflow-advanced.md (both languages) now names recall: true.
  • The test reads the step through ClonePlaceSchema.parse, so the cast is gone.

[P1 blocking] Still open: the real-CLI record. As your comment says, nothing yet shows a trial clone actually receiving the recall deployment. One teamai benchmark run showing the recall files inside the clone of an arm with recall: true, and their absence for an arm without it, closes it.

[P2 non-blocking] The new example in "Arms that run with recall" is a suite the CLI refuses. I agree with the CI review here. In docs/guide/benchmarks.md (and the zh-CN copy) the arms with-relations (recall: true) and baseline (recall: false) set no defaults key, so changedKeys returns [] for both, and the suite check in src/benchmark/suite.ts rejects the second with arm "baseline" changes none of the defaults keys, and neither does arm "with-relations"; at most one arm changes none. Even if it parsed, dimensionOf in history.ts would find no dimension between them, so the page would never compare them. Your PR body says the same thing ("a suite whose arms differ only in recall is refused"), and so does the comment on ArmFileSchema.recall: a suite that measures relations sets recall on every arm and varies something else. The example should show that, e.g. both arms recall: true, one with team: { without: [<the relations file>] }. The opening question ("Does the team's recall help a task at all") would then read better as what the suite actually answers: whether the declared relations help, with recall on in both arms.

@jeff-r2026 your call on this one: it adds a suite key, and through the shared clone schema also a workflow key, for #1564's measurement.

The plan test stops at the step definition; nothing showed a trial clone
actually getting the team's recall deployment. This runs the suite for real:
two arms, one with `recall: true`, one without, and reads the files of each
trial's clone from what the fake tool recorded in its cwd.

The arm that asked for it gets the recall agent, the recall rule and the
context rule; the arm that did not gets none of them.

Without the feature the suite does not even parse, so the case fails there
rather than on the assertion.

Co-Authored-By: Claude Code <[email protected]>
@Walternater

Copy link
Copy Markdown
Collaborator Author

c7cf3cd and 4bacfa3 close the P1 with a real run.

src/__tests__/e2e/benchmark-recall.test.ts runs the suite for real — two arms, one with recall: true, one without — and reads the files of each trial's clone from what the fake tool recorded in its cwd:

with-recall
  .claude/agents/teamai-recall.md
  .claude/rules/teamai-context.md
  .claude/rules/teamai-recall.md
  .claude/settings.local.json
  .claude/skills/teamai/SKILL.md
  .claude/skills/teamai-session-to-task/SKILL.md
  .claude/skills/teamai-share-learnings/SKILL.md
  .claude/skills/teamai-share-session/SKILL.md
  README.md, answer.js, test.js

baseline
  .claude/settings.local.json
  .claude/skills/teamai/SKILL.md
  .claude/skills/teamai-session-to-task/SKILL.md
  .claude/skills/teamai-share-session/SKILL.md
  README.md, answer.js, test.js

The recall agent, the recall rule and the context rule are in the arm that asked for them and in none of the other. Both arms ran the same task on the same tool.

Without the feature the suite does not parse — recall is not a key the schema knows — so the case fails with benchmark_not_found rather than on the assertion, which is the stronger form of the same check.

One suite detail worth knowing: a suite needs at most one arm that changes no defaults key, and recall is not one, so the second arm names a model.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
  • [P1 blocking] Missing real-CLI verification record remains unresolved — PR description, “Verification”; runtime change at src/workflow/place/clone.ts:601. The description records unit tests, typecheck, and lint, but no real-CLI execution. Adding src/__tests__/e2e/benchmark-recall.test.ts:1 is not a record of it passing. This violates the first Code Review Rules item: document one representative run after building that verifies recall deployment in a trial clone.

  • [P2 non-blocking] The recall example remains invalid — docs/guide/benchmarks.md:201 and docs/guide/zh-CN/benchmarks.md:201. The example’s arms differ only in recall, which deliberately does not count toward comparison keys, so the suite is rejected. Show arms differing in a supported comparison key, with recall enabled on both when measuring declared relations.

Neither earlier finding is resolved. No other confident findings in the scoped diff. Nothing from the PR was run, built, or installed.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Thanks, 4bacfa3 closes the P1. I built the head and ran benchmark-recall.test.ts: it passes, and the trial clones hold what your comment lists. The recall agent and both recall rules are in with-recall's clone and in none of baseline's. I added that run to the PR body under "Real-CLI verification", since the CI review reads the body. Two non-blocking points are left.

[P2 non-blocking] The test still passes when every clone gets recall. without is the first launch that lacks teamai-recall.md. If both clones have it, without is undefined, and expect(undefined).not.toEqual(expect.arrayContaining(recallFiles)) passes. I checked by replacing team.recall ?? false with true in src/workflow/place/clone.ts: the case still passes. So it guards against the arm missing recall, but not against recall reaching the baseline, which is the half that keeps every other workflow clone as it was. Asserting that the baseline exists and holds none of the files closes it:

expect(without, 'no clone ran without recall').toBeDefined();
expect(without?.paths.filter((file) => recallFiles.includes(file))).toEqual([]);

[P2 non-blocking] Still open from the last round: the example in "Arms that run with recall" is refused. 4bacfa3 only adds the test, and docs/guide/benchmarks.md and its zh-CN page still show two arms that differ only in recall. As the new test's own comment says, a suite needs a defaults key that differs between the arms, and the test gives baseline a model for that reason. The example would work with recall: true on both arms and team: { without: [...] } on one.

@jeff-r2026 your call on this one: it adds a suite key, and through the shared clone schema also a workflow key, for #1564's measurement.

The case found the first launch without the recall agent and asserted it
held none of the recall files. When every clone had recall, that launch did
not exist, the assertion was against undefined, and the case passed — so it
guarded the arm that asked for recall but not the one that did not, which is
the half that keeps every other workflow clone as it was.

It now asserts the clone without recall exists, and that it holds none of
the files. Replacing `team.recall ?? false` with `true` in
src/workflow/place/clone.ts fails the case, as it should.

The doc example was refused by the suite's own rules: two arms differing only
in `recall` change no `defaults` key, and at most one arm may do that. Both
arms now run with recall and differ in their `team` instead, which is the
comparison the section is about.

Co-Authored-By: Claude Code <[email protected]>
@Walternater

Copy link
Copy Markdown
Collaborator Author

3de8101 addresses both.

The test that passed when every clone got recall. You were right, and I checked it the way you did — replacing team.recall ?? false with true in src/workflow/place/clone.ts, the old case still passed, because without was undefined and the assertion was against undefined.

The case now asserts the clone without recall exists, and that it holds none of the recall files:

expect(without, 'no clone ran without recall').toBeDefined();
expect(without?.paths.filter((file) => recallFiles.includes(file))).toEqual([]);

With recallEnabled: true the case fails:

AssertionError: no clone ran without recall: expected undefined to be defined

The doc example the suite refuses. Right — two arms differing only in recall change no defaults key, and at most one arm may do that. Both arms now run with recall and differ in their team instead, which is the comparison the section is about:

arms:
  - name: with-relations
    recall: true
  - name: without-relations
    team: { without: [rules/payments.md] }
    recall: true

I checked the example parses: parseSuite accepts it and gives the arms recall: true with pulled and without teams. Both guides are updated.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

No confident new findings in the scoped diff.

Both earlier findings are resolved:

  • Missing real-CLI record: The description now records a build and one passing built-CLI benchmark test, including recall deployment evidence. The older recorded commit is a note, not a blocker under the review rules.
  • Invalid recall example: Both language versions now differ in team, with recall: true on both arms.

Nothing from the PR was run, built, or installed during this review.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Thanks, 3de8101 closes both points, and nothing is open on my side.

  • Test. The case now requires a clone without recall and checks that it holds none of the three files. A change that gives every clone recall fails it, as your run shows.
  • Docs. In the new example, with-relations changes no defaults key and without-relations changes only team, so changedKeys accepts the suite and the page compares the two arms on team, with recall on in both. That's the comparison the section describes. The zh-CN page matches.

I'll lift my request for changes once CI is green on this head; CI passed on 4bacfa3, and this push only touches the test and the docs.

@jeff-r2026 your call on this one: it adds a suite key, and through the shared clone schema also a workflow key, for #1564's measurement.

@SaulMoro
SaulMoro dismissed stale reviews from themself November 5, 2026 08:41

Resolved at 3de8101: the real-CLI record is in the description and both earlier points are fixed. Leaving the merge to @jeff-r2026.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Everything from the earlier rounds is resolved at 3de8101: the exhaustive switch, the docs in both languages, the test that now requires a clone without recall, and the real-CLI record in the description. CI is green. Approving.

@SaulMoro
SaulMoro merged commit 2f97047 into Tencent:main Nov 5, 2026
18 checks passed
jeff-r2026 pushed a commit that referenced this pull request Nov 6, 2026
`#1728` gave an arm `recall: true` and the run wrote it onto the record's arms,
which are the plan's arms. `BenchmarkRecordSchema.arms` had no `recall`, and a
record is read back through that schema, so zod dropped it: the file on disk
said an arm ran with recall and every reader saw an arm that never had.

The results gain a Recall column (`on`/`off`) once any arm runs with it, the
shape the Role column already has, and the guides say the record keeps it.

#1564 asks the run record to show recall was on; this is that field.

Co-authored-by: Claude Code <[email protected]>
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.

3 participants