Repository navigation
feat(scorers): show the session judge the team skills it had and used - #1606
Merged
Merged
Conversation
…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
approved these changes
Oct 31, 2026
jeff-r2026
left a comment
Collaborator
There was a problem hiding this comment.
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.
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsongetsskills: { 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 onmain.What changed from #1561's last head:
git ls-treeinstead of onegit showper skill, and one skill-root walk instead of two.name:line. A skill whoseSKILL.mdhas noname: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.availableandused. Names are read at the delivered revision instead of from today's team repo.description: Cut an npm release: bump, tag.is now left out instead of recorded as"".namespaceUnknown. The role-manifest narrowing is gone: it ignored projects, so a skill delivered through a project namespace could come outnamespaceUnknown, and it could not reproduce pull's choice anyway.docs/guide/scorers.mdand its zh-CN page now cover theskillskey and theskills_unknowngap.parseRolesManifestContentare gone.Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest runpasses: 19,517 passed. Only the GitLab request-deadline tests (gitlab-*-timeout.test.ts) fail, a different case on each run. They also fail onmainon this machine, and this diff does not touch them.Each of these new capture tests failed before its fix and passes after:
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 realinitandpull, ranhook-dispatch session-start --tool claude9 times per build, alternating builds:main313341fmainAll three builds captured 150 skills.
Real CLI, the review scenarios at 6333b0c. The team has
ops/shipandweb/ship(neither has aname:line),web/goneandweb/release(unquoted colon in its description). The member pulls asweb. The team then deletesweb/gone, and the shared team clone advances without this checkout pulling. Thenroles set ops, a session that loadsgone, andscore:The #1561 head, on the same script, gives
used: [],"description": ""forrelease, and no namespace forgone.Not covered locally: Codex, CodeBuddy and OpenCode sessions, and the
gitlab/githubproviders. CI covers those.Related Issues
Part of #1469 (routing questions and
skill_routingstay with the follow-up after #1180). Supersedes #1561.Notes for Reviewers
namespaceUnknowneven 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.deliveredTeamSkillsalso feeds the workflow local driver'sused. That driver now reads names at the delivered revision too, so the same deleted-skill fix applies to workflow steps.HEAD, and same-name skills come outnamespaceUnknown.usedlist of session and workflow labels.Co-authored-by: Ousama Benyounes [email protected]