Skip to content

feat(scorers): show the session judge the team skills it had and used - #1606

Merged
jeff-r2026 merged 8 commits into
Tencent:mainfrom
SaulMoro:feat/skill-evidence-1469
Oct 31, 2026
Merged

jeff-r2026 merged 8 commits into
Tencent:mainfrom
SaulMoro:feat/skill-evidence-1469

Conversation

@SaulMoro

Copy link
Copy Markdown
Collaborator

Summary

A session judge sees neither the team skills a session was delivered nor the ones it loaded. This lands the evidence-only slice of #1469: each session capture records every delivered team skill's namespace and description, and evidence.json gets skills: { available, used }. This continues #1561 by @ousamabenyounes. Their five commits are kept as they wrote them, and three commits on top fix the open review points. With those fixes the session-start hook costs the same as on main.

 hook-dispatch session-start
   SessionCaptures.atStart
-    deliveredTeamSkills        # walk 1: names from today's team repo
-    deliveredTeamSkillInfo     # walk 2: today's resolver, roles manifest at rev,
-                               #         one `git show` per delivered skill
+    deliveredTeamSkills        # one walk -> { teamSkills, teamSkillInfo }
+      git ls-tree <delivered rev> -- skills     # one call, every name
+      name in one team directory   -> its namespace, no further read
+      name in several directories  -> isRecordedFromTeamSkill up to <rev>
+                                      (pull's own check: renders the added `name:`)
+      identical copies              -> namespaceUnknown
+      description only when the frontmatter parses

What changed from #1561's last head:

  • Session-start cost. Session start now runs one git ls-tree instead of one git show per skill, and one skill-root walk instead of two.
  • No name: line. A skill whose SKILL.md has no name: line now gets its delivered namespace. Same-name sources are matched the way pull matches them, so the line pull adds no longer breaks the match.
  • Skill deleted after the pull. It now counts in both available and used. Names are read at the delivered revision instead of from today's team repo.
  • Unquoted colon in a description. A description such as description: Cut an npm release: bump, tag. is now left out instead of recorded as "".
  • Identical copies in two namespaces. These are now always namespaceUnknown. The role-manifest narrowing is gone: it ignored projects, so a skill delivered through a project namespace could come out namespaceUnknown, and it could not reproduce pull's choice anyway.
  • Scorers guide. docs/guide/scorers.md and its zh-CN page now cover the skills key and the skills_unknown gap.
  • Removed. The two non-null assertions, the duplicated description read and parseRolesManifestContent are gone.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes
  • npx vitest run passes: 19,517 passed. Only the GitLab request-deadline tests (gitlab-*-timeout.test.ts) fail, a different case on each run. They also fail on main on this machine, and this diff does not touch them.
  • Added/updated tests for the change

Each of these new capture tests failed before its fix and passes after:

records the namespace of a delivered copy pull completed the frontmatter of
  before: namespace "ops"            after: namespace "web"
records a delivered skill the team deleted after the pull
  before: teamSkills {}              after: { review: [...] }
records no description when the delivered frontmatter does not parse
  before: { description: "" }        after: {}
keeps identical copies unattributed when the team deletes one after the pull
  before: namespace "ops"            after: namespaceUnknown: true

npm run test:e2e -- src/__tests__/e2e/score-session.test.ts: 6 passed.

Real CLI, session-start cost. The built CLI with 150 delivered team skills (75 root, 75 under ops/), after a real init and pull, ran hook-dispatch session-start --tool claude 9 times per build, alternating builds:

build median min–max
main 313341f 195 ms 184–196
#1561 head, rebased on main 957 ms 888–971
this branch 6333b0c 194 ms 190–199

All three builds captured 150 skills.

Real CLI, the review scenarios at 6333b0c. The team has ops/ship and web/ship (neither has a name: line), web/gone and web/release (unquoted colon in its description). The member pulls as web. The team then deletes web/gone, and the shared team clone advances without this checkout pulling. Then roles set ops, a session that loads gone, and score:

$ teamai init https://github.com/acme/team.git --provider git --agent claude --scope user --role web --force
$ teamai pull
delivered: gone, release, ship
$ teamai roles set ops
$ teamai hook-dispatch session-start --tool claude
capture.teamSkills: ["gone","release","ship"]
$ teamai score --session 7c1e…1561 --source claude-code --scorer review-quality
evidence.json skills: {
  "available": [
    { "name": "gone", "namespace": "web", "description": "Soon deleted." },
    { "name": "release", "namespace": "web" },
    { "name": "ship", "namespace": "web", "description": "Web release." }
  ],
  "used": ["gone"]
}
evidence.json gaps: []

The #1561 head, on the same script, gives used: [], "description": "" for release, and no namespace for gone.

Not covered locally: Codex, CodeBuddy and OpenCode sessions, and the gitlab/github providers. CI covers those.

Related Issues

Part of #1469 (routing questions and skill_routing stay with the follow-up after #1180). Supersedes #1561.

Notes for Reviewers

  • Credit. The feature and the first five commits are @ousamabenyounes's work from feat(scorers): expose delivered team skills in session evidence #1561, with authorship kept. Please keep the trailer below in the squash commit.
  • Identical copies. For identical copies in two namespaces, the evidence now says namespaceUnknown even when only one of the two roles was selected. Before, it picked one from the role manifest at the delivered revision. That is less specific, but never wrong.
  • Workflow steps. deliveredTeamSkills also feeds the workflow local driver's used. That driver now reads names at the delivered revision too, so the same deleted-skill fix applies to workflow steps.
  • Unreadable revision. When git cannot read the delivered revision, the name set falls back to the clone's HEAD, and same-name skills come out namespaceUnknown.
  • Rollback. This is a two-way door: it adds optional capture and evidence fields only. The blast radius is the session-start hook and the used list of session and workflow labels.

Co-authored-by: Ousama Benyounes [email protected]

ousamabenyounes and others added 8 commits October 30, 2026 23:58
…ent#1469)

A session judge could not tell which team skills a session was delivered
or which it loaded: evidence.json held only the subject, kind and gaps,
and the judge never read the label's used.skills. This lands the
evidence-only slice of Tencent#1469 (which the issue notes can ship first,
independently of the Tencent#1180 reserved-name work) so a later change can add
the routing questions on top.

At session start the capture now records, per delivered team skill, the
frontmatter description its SKILL.md then carried and the skills
namespace it came from (deliveredTeamSkillInfo), beside the existing
name->files record. A session's own pull adds the skills it delivers
with the description they then have; a later pull changes nothing.

judgeSession builds a skills block for the manifest from those captures:
skills.available is the union across captures (latest description of a
name wins, each masked with the scope mask, a root skill has no
namespace) and skills.used is the label's bare names, unchanged. A
checkout with no team skills yields skills: { available: [], used: [] }
and no gap; a session whose captures recorded no descriptions (for
example one captured before this change) gets no skills key and the new
skills_unknown evidence gap. The Tencent#1399 scorer-file control now reads the
session's own captures instead of none, so it keeps skills.available.

Out of scope here (left for the follow-up): skill_routing, the
scorers/scoring.yaml key, and the per-skill routing scorer names.

Tests: unit tests for the skills manifest (gap, empty, union/latest,
masking), the capture's descriptions and namespaces, and judgeSession's
manifest; real upstream RED proven before the change, GREEN after.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Session start ran one `git show` per delivered skill to find each one's
namespace, about 3x the hook's time with 150 skills, and walked the
skill roots twice.

deliveredTeamSkills now does one walk and returns both the files and
what a session records of each skill. A single `git ls-tree` at the
delivered revision lists every team skill: a name in one directory takes
its namespace with no further read. Only a name in several directories
is checked with isRecordedFromTeamSkill, which renders the source as
pull writes it, so a SKILL.md pull added `name:` to still matches.
Identical copies stay namespaceUnknown; the role-manifest narrowing is
dropped since it ignored projects and could not reproduce pull's choice.

Reading names at the delivered revision also keeps a skill the team
deleted after the pull in teamSkills, so a session that loads it is
credited in `used`, matching `available`. A description is recorded only
when the frontmatter parses, instead of as "". The scorers guide now
names the `skills` key and the `skills_unknown` gap.

Tests: new capture tests for the rewritten frontmatter, the deleted
skill and the unparsable description failed before this change and pass
after. hook-dispatch session-start with 150 delivered skills: median
958 ms before, 192 ms after (main: 194 ms).
A SKILL.md under a root skill's own directory is not a namespaced skill,
as collectTeamRepoSkills reads the tree; without that rule the fixture's
ship turns namespaceUnknown. Evidence keeps a skill with no recorded
description without one.
isRecordedFromTeamSkill read the history of HEAD. When the team deleted
one of two identical copies after the pull, the other matched alone and
the capture named its namespace though the delivered copy was unchanged.
historicalVersions and isRecordedFromTeamSkill take an optional rev
(HEAD by default, so pull is unchanged); the capture passes the
delivered revision.

Test: identical ops/ship and web/ship at the delivered revision, web/ship
deleted afterwards, failed with namespace "ops" and now stays
namespaceUnknown.

@jeff-r2026 jeff-r2026 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.

Verified on main 313341f (also merges cleanly together with #1591 and the lint PRs): tsc, lint (0/0), build pass; session-captures, skill-evidence, skill-use, team-history, delivered, local-driver and scorer unit tests 364 passed; E2E score-session + score-sessions 7/7 with the built CLI, including the real session-start hook -> score flow from #1469. An independent agent review found no blocking issue; the #1561 review points (one ls-tree at session start, missing name: line, deleted skill, unquoted colon) are resolved. [P3 nit] after a pre-push sync of a same-name skill, record.rev predates the new copy, so it is recorded as namespaceUnknown rather than its real namespace.

@jeff-r2026
jeff-r2026 merged commit 22a9f2d into Tencent:main Oct 31, 2026
16 checks passed
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
…Tencent#1606)

* feat(scorers): record delivered team skills in session evidence (Tencent#1469)

A session judge could not tell which team skills a session was delivered
or which it loaded: evidence.json held only the subject, kind and gaps,
and the judge never read the label's used.skills. This lands the
evidence-only slice of Tencent#1469 (which the issue notes can ship first,
independently of the Tencent#1180 reserved-name work) so a later change can add
the routing questions on top.

At session start the capture now records, per delivered team skill, the
frontmatter description its SKILL.md then carried and the skills
namespace it came from (deliveredTeamSkillInfo), beside the existing
name->files record. A session's own pull adds the skills it delivers
with the description they then have; a later pull changes nothing.

judgeSession builds a skills block for the manifest from those captures:
skills.available is the union across captures (latest description of a
name wins, each masked with the scope mask, a root skill has no
namespace) and skills.used is the label's bare names, unchanged. A
checkout with no team skills yields skills: { available: [], used: [] }
and no gap; a session whose captures recorded no descriptions (for
example one captured before this change) gets no skills key and the new
skills_unknown evidence gap. The Tencent#1399 scorer-file control now reads the
session's own captures instead of none, so it keeps skills.available.

Out of scope here (left for the follow-up): skill_routing, the
scorers/scoring.yaml key, and the per-skill routing scorer names.

Tests: unit tests for the skills manifest (gap, empty, union/latest,
masking), the capture's descriptions and namespaces, and judgeSession's
manifest; real upstream RED proven before the change, GREEN after.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(scorers): preserve skill evidence provenance

* fix(scorers): resolve identical skills at delivered revision

* fix(skills): avoid ambiguous namespace provenance

* fix(skills): preserve uncertain provenance

* perf(skills): resolve delivered skill namespaces from one tree listing

Session start ran one `git show` per delivered skill to find each one's
namespace, about 3x the hook's time with 150 skills, and walked the
skill roots twice.

deliveredTeamSkills now does one walk and returns both the files and
what a session records of each skill. A single `git ls-tree` at the
delivered revision lists every team skill: a name in one directory takes
its namespace with no further read. Only a name in several directories
is checked with isRecordedFromTeamSkill, which renders the source as
pull writes it, so a SKILL.md pull added `name:` to still matches.
Identical copies stay namespaceUnknown; the role-manifest narrowing is
dropped since it ignored projects and could not reproduce pull's choice.

Reading names at the delivered revision also keeps a skill the team
deleted after the pull in teamSkills, so a session that loads it is
credited in `used`, matching `available`. A description is recorded only
when the frontmatter parses, instead of as "". The scorers guide now
names the `skills` key and the `skills_unknown` gap.

Tests: new capture tests for the rewritten frontmatter, the deleted
skill and the unparsable description failed before this change and pass
after. hook-dispatch session-start with 150 delivered skills: median
958 ms before, 192 ms after (main: 194 ms).

* test(skills): cover a nested skill directory and an unread description

A SKILL.md under a root skill's own directory is not a namespaced skill,
as collectTeamRepoSkills reads the tree; without that rule the fixture's
ship turns namespaceUnknown. Evidence keeps a skill with no recorded
description without one.

* fix(skills): read same-name skill history up to the delivered revision

isRecordedFromTeamSkill read the history of HEAD. When the team deleted
one of two identical copies after the pull, the other matched alone and
the capture named its namespace though the delivered copy was unchanged.
historicalVersions and isRecordedFromTeamSkill take an optional rev
(HEAD by default, so pull is unchanged); the capture passes the
delivered revision.

Test: identical ops/ship and web/ship at the delivered revision, web/ship
deleted afterwards, failed with namespace "ops" and now stays
namespaceUnknown.

---------

Co-authored-by: Ousama Benyounes <[email protected]>
Co-authored-by: Claude Opus 4.8 <[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