Skip to content

feat(resources)!: change one file of a teamai default, and keep any kind as a file or a folder - #1836

Merged
SaulMoro merged 43 commits into
Tencent:mainfrom
hz89Dev:feat/resource-folders
Nov 12, 2026
Merged

SaulMoro merged 43 commits into
Tencent:mainfrom
hz89Dev:feat/resource-folders

Conversation

@hz89Dev

@hz89Dev hz89Dev commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A team changes only the files it means to change in a teamai default, and every kind of resource can be a file or a folder.

teamai default ──inherits──▶ the team's folder of the same name (teamai-x)   per file, the team's file wins
team root      ──replaces whole──▶ active namespace                          as before, no inheritance
file form      ──replaces whole──▶ a folder default of the same name         as before (workflows, rules)
Kind File Folder What changed
hooks, rules, workflows as before HOOK.yaml / RULE.md / WORKFLOW.yaml a team folder named like a teamai default inherits the default's other files
skills skills/[<ns>/]<x>.md, delivered as <x>/SKILL.md SKILL.md file form; team skills resolve through Resources
agents <x>.md AGENT.md delivered like a rule folder; the body names its files with ${TEAMAI_AGENT_DIR}
scorers <x>.md SCORER.md the judge reads the folder's files through ${TEAMAI_SCORER_DIR}

What else moved:

  • A team file in a teamai-* folder that replaces no file of the default: pull warns, names it, and keeps teamai's file. review --branch fails. Contracts (the recall rule, a hook default's keys and texts) are checked on the resulting folder. A refused result leaves the default in force whole.
  • A run of a folder that inherited a file records {source: "team", teamRevision, teamaiVersion} and is definition_mismatch on a machine whose teamai or team commit cannot rebuild it.
  • list --json marks each file's layer (teamai or team).
  • Every marker is now read, so the [feat] Reserve folder marker names so older teamai skips folders it cannot read #1791 "skipped folders" machinery is gone: the doctor check, the status list and the dashboard panel. A checkout record from an older release that lists skippedFolders still forces one full sync, so those folders are delivered on the first pull after upgrading.
  • Push refuses to put a rule, agent or scorer file inside a folder of its type (<path>/ holds <MARKER>, so the file would be one of its files, not a resource of its own.). A scorer folder pushes as one scorer.
  • Ownership proof ([bug] Delivery and local-state bugs on main found while scoping #915 #993) covers both forms (CopyOrigin.alternatives), and uninstall removes a worktree's .teamai/ once its delivered folders are gone.
  • The tool fact ruleFolders is now folderReach, since rule and agent folders share it. The persisted ruleFolderGrants key is unchanged.

Type of Change

  • New feature (non-breaking change that adds functionality)

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes (docs checks included)
  • Full npx vitest run: 786 files, 23,940 tests pass. Related E2E (npm run test:e2e, 65 files, 519 tests) pass.
  • Added and updated tests. Each fix was red on its own reason first.

Real CLI (worlds from npm run verify:world)

50226a8 (teamai 0.22.0): rows 1, 2, 3, 9 and 10 re-run after the rebase, with the same reads and markers as below, and a second pull that synced nothing. Ledger: 11 LEAKS (tool state and dashboard files, as below) and Ledger: 1 LEAK (home/.codex, where the setup copied the Codex sign-in).

Final head 389c3cd (world built from it, git mode, workspace), the review fixes:

  • Notes under skills/: the team repo holds skills/payments/greet.md (with a description), skills/NOTES.md and skills/payments/CONTRIBUTING.md (no frontmatter). teamai pull: Synced 1 skills (1 new, 0 updated) new: greet; no NOTES or CONTRIBUTING skill delivered. teamai review --branch notes on a branch adding them: 0 fail, 0 warn, 6 info, exit 0.
  • scorers/SCORER.md at the scorers root: the scorer cache holds SCORER.json beside style.json.
  • A team folder over teamai-import-from-repo that is small on its own but over 1 MB once merged: pull refuses it (it holds 1063879 bytes, more than the 1048576 bytes (1 MB) a folder may hold) and the default stays in force.
  • Ledger: 1 LEAK (home/.codex, the setup's copy of the Codex sign-in).

Head 6f8162d (world built from it): teamai score --session <id> --source claude-code --scorer ./scorers/SCORER.md, with a broken symlink scorers/gone.md beside it, gives SCORER from scorers/SCORER.md: styled (score 1, passed). Before the fix that file was read as a folder holding scorers/ and refused (gone.md is a symlink). The ledger lists Claude Code's own state only (home/.claude*, home/.cache).

Head 73e768d (worlds built from it, workspace):

  • From inside draft/style/ (a scorer folder holding SCORER.md and rubric.md), teamai score --session <id> --source claude-code --scorer ./SCORER.md gives style from SCORER.md: styled (score 1, passed).
  • After teamai pull delivers .teamai/delivered/agents/reviewer/ (AGENT.md, rubric.md) and the member commits .claude/agents/reviewer.md to the project, teamai remove agents reviewer --force warns Kept <world>/project/.claude/agents/reviewer.md: this repository tracks it, so teamai does not delete it. Both the kept copy and the delivered folder its text names (…/.teamai/delivered/agents/reviewer/rubric.md) are still there afterwards. Ledger: 5 LEAKS: home/.codex (the setup's sign-in copy), the member's tracked copy with the folder it names, which uninstall keeps by design, and the project commit made for the check.

Head e7ec0c5 (world built from it, workspace): after teamai pull delivers reviewer, the member's enabledAgents becomes [codex] so Claude Code is excluded. teamai remove agents reviewer --force gives Removed 1 agents from 1 location(s). .claude/agents/reviewer.md and the folder it names, .teamai/delivered/agents/reviewer/ (AGENT.md, rubric.md), are both still there. Ledger: 1 LEAK (home/.codex).

Acceptance table, 2026-11-12, worlds built from f4a8ec7 (the same code before rebasing onto main and the two fixes at the end) (teamai 0.22.0, node v24.21.0, git 2.56.0). Tools: Claude Code 2.1.322 (claude -p --model haiku), Codex 0.167.1. Repo mode: git. Team repo: manifest/roles.yaml with roles payments and web; the member ran teamai init https://teamai.test/team/repo.git --provider git --agent claude --role payments, then teamai roles set web. Each support file holds a marker no other file holds. <world> is the world directory.

# Team repo Scope / tool Command Proof Result
1 rules/api-style/RULE.md naming ${TEAMAI_RULE_DIR}/checklist.md workspace, Claude claude -p "What name should a REST endpoint that lists invoices have? Follow the team rules." delivered rule: read <world>/project/.teamai/delivered/rules/api-style/checklist.md, no literal ${. Transcript: Read {"file_path": "<world>/project/.teamai/delivered/rules/api-style/checklist.md"}. Reply ends with TOKEN-RULE-7Q2 pass
1 same user, Claude same Read {"file_path": "<world>/home/.teamai/rules/api-style/checklist.md"}, reply ends with TOKEN-RULE-7Q2. ~/.claude/settings.json additionalDirectories holds ~/.teamai/rules and ~/.teamai/agents pass
1 same workspace, Codex codex exec "…same prompt…" cat .teamai/delivered/rules/api-style/checklist.md, reply Use GET /invoices … TOKEN-RULE-7Q2 pass
1 same user, Codex same pull warns codex may ask before it reads the files of user-scope rule folders in <world>/home/.teamai/rules (api-style). Session: cat <world>/home/.teamai/rules/api-style/checklist.md, reply ends with TOKEN-RULE-7Q2 pass
2 agents/reviewer/AGENT.md naming ${TEAMAI_AGENT_DIR}/rubric.md workspace, Claude claude -p "Use the reviewer subagent to review this snippet: function add(a, b) { return a - b }" Agent {"subagent_type": "reviewer"}. Inside it: Read {"file_path": "<world>/project/.teamai/delivered/agents/reviewer/rubric.md"}. Its review ends TOKEN-AGENT-4K8 pass
2 same user, Claude same .claude/agents/reviewer.md: Read <world>/home/.teamai/agents/reviewer/rubric.md first…. Subagent read that file, review ends TOKEN-AGENT-4K8 pass
2 same Codex — not applicable: Codex gets no copy of a Markdown agent, file or folder, as on main (only tools with legacyAgentMd read Markdown agents) n/a
3 skills/payments/greet.md (file form) workspace, Claude teamai pull, then claude -p "Greet Alice." ✔ [workspace] Synced 1 skills (1 new, 0 updated) new: greet; .claude/skills/greet/SKILL.md delivered. Transcript Skill {"skill": "greet"}, reply Hello, Alice! … TOKEN-SKILL-9M3 pass
4 scorers/style/SCORER.md naming ${TEAMAI_SCORER_DIR}/rubric.md workspace, Claude teamai score --session <A> --source claude-code --scorer style, then the same for <B> A, whose reply holds the marker: style: styled (score 1, passed), reasoning The final answer 'Done. TOKEN-SCORER-2P5' contains the required token. B: style: unstyled (score 0, did not pass). Only rubric.md holds the rule pass
5 workflows/payments/release/ (WORKFLOW.yaml + prompts/plan.md) workspace, Claude teamai workflow start release --driver local --tools default=claude --sandbox payments: outcome: succeeded, plan succeeded {'answer': 'TOKEN-WF-PAY-5H1'}. web: ✔ [workspace] Synced 1 workflow (payments got 2), and its release is the root's (row 6) pass
6 workflows/release/ at the root and workflows/payments/release/ workspace, Claude same, as each member payments' run folder copy: WORKFLOW.yaml, prompts/plan.md = Set answer to the token TOKEN-WF-PAY-5H1. (no root file). web: plan succeeded {'answer': 'TOKEN-WF-ROOT-8C6'}, folder copy holds the root's two files pass
7 workflows/review-run.yaml: a prompt step with agent: reviewer, workspace: new workspace, Claude teamai workflow start review-run --driver local --tools default=claude --sandbox session cwd <world>/project/.teamai/workflow-worktrees/teamai-r…-review-p1-…. It read …/review-p1-…/.teamai/delivered/agents/reviewer/rubric.md. Output review: "Bug: … returns a - b … TOKEN-AGENT-4K8" pass
8 benchmarks/payments/smoke/ (SUITE.yaml, one task) workspace, Claude teamai benchmark run smoke --sandbox payments: | claude | claude | haiku (team) | 1 | 1 | 0 | … | 100% (1/1) |. web: benchmark_not_found: Suite "smoke" has no runnable version for this member. pass
9 hooks/teamai-env-hint/variables.md only workspace, Claude teamai pull; claude -p "Quote, word for word, the sentence about team env variables that the session start gave you"; teamai list hooks --json delivered folder: HOOK.yaml README.md README.zh-CN.md exec.md secrets-rule.md secrets.md variables.md. Session: Team env variables here (TOKEN-HOOK-3T9): PAYMENTS_API (Payments API endpoint). JSON: "source": "team, over teamai default 0.22.0 (1 own files, 6 inherited)", variables.md "layer": "team", the other six "layer": "teamai" pass
10 row 9 plus hooks/teamai-env-hint/extra.md workspace teamai review --branch stray; teamai pull after merging it review exit 1: ✖ [structure] hooks/teamai-env-hint/extra.md replaces no file of teamai's default, so it is not used and teamai's files stay in force. …. Pull: ⚠ hooks/teamai-env-hint/extra.md replaces no file of teamai's default …; delivered folder unchanged, no extra.md pass

Prompt steps that read $TEAMAI_WORKFLOW_DIR (rows 5–7) run with permissions: unattended and requires: { isolation: sandbox, strict: true }, started with --sandbox. Headless Claude otherwise asks before it reads outside the checkout (docs/guide/workflow-advanced.md, Unattended prompts). The world is a throwaway HOME.

Ledger (npm run -s verify -- ledger <run>): not CLEAN in any world. Claude workspace: Ledger: 21 LEAKS. Codex workspace: Ledger: 4 LEAKS. Claude and Codex user scope: Ledger: 9 LEAKS. Every leak is a tool's own state (home/.claude*, home/.codex, home/.cursor, home/.npm, home/Library), a workflow run's leftovers (project/.teamai/workflow-worktrees, workflow-hooks, refs/heads/teamai/…, .git/config worktreeConfig), an empty tool directory (project/.codex, like the known #1808 project/.claude), or teamai's dashboard and usage files. None comes from a file this branch changes (git diff origin/main --stat is empty for their writers). What this branch delivers is gone after teamai uninstall: .teamai/delivered/, ~/.teamai/agents, ~/.teamai/rules, .claude/agents/reviewer.md, and every skill including greet.

Hit every surface

  • Tools: Claude Code and Codex were run (above). A per-tool fact lives in TOOLS (folderReach). Tools that can't read a user-scope folder get a warning naming the directory. CodeBuddy and OpenCode are left to CI.
  • Scopes: workspace and user, both run.
  • Team repo modes: git was run. Self mode reads .teamai/<kind>/ folders the same way (unit tests); not run in a world, which cannot set it up. HTTP mode installs one downloaded .md per agent, as on main, so agent and rule folders do not reach HTTP members. Unchanged.
  • Checkouts: a linked worktree and a workflow run's own worktree (row 7) each name their own delivered copy. Submodule, workspace children and bare repo follow rule folders' projectRoot; not exercised.
  • Layers: a default, its replacement at the team root (rows 9–10), and an active namespace (rows 3, 5, 6, 8).
  • Entry points: pull, push, review --branch, list, status, score, workflow start, benchmark run, uninstall; the session-start hook (row 9); the dashboard (skipped panel removed, improvement page reads skills through Resources).
  • Reverse states: pull removes a dropped folder's copies and a removed namespace's agents; uninstall removes delivered folders and the emptied .teamai/; ref switches name every form when they find removals.
  • Runs: first and second pull; a pull after an older release's skippedFolders record syncs in full once.
  • OS: Windows CI runs its subset. Path joins use forward slashes where a prompt or a record reads them.
  • Docs and skill-data/: sharing.md, scorers.md, workflow.md, dashboard.md and others (EN and zh-CN), skill-data/core/references/troubleshooting.md, the glossary (Marker file, teamai default), and generated tool-support pages.

Notes for Reviewers

  • Budgets: the agent context budget and agent wait budget checks pass at e7ec0c5 and report no growth against main.
  • Decision: a default scorer is replaced by a file only. scorers/teamai-<default>/SCORER.md is refused with a warning that names the file form, and teamai's default keeps running (documented in docs/guide/scorers.md). A default scorer's replacement may read only the variables the default offers (src/default-scorers.ts). Its rubric is filled into generated questions (routing, adoption, benchmark correctness) whose pins and frozen benchmark plan carry text only.
  • Decision: a workflow run continued on another machine is accepted from that machine's cache when the folder's sourceHash and definition hash both match. The hash covers every file, inherited ones included. The teamai version check guards the rebuild from the team commit, which lacks the inherited files.
  • Gaps found while building it and closed here, one commit each:
    • 7825305 fix(dashboard): count a skill kept as one file on the improvement page
    • d04c049 refactor(tools): name how a tool reads a delivered folder, not a rule folder
    • 3e695e8 fix(agents): prove an unrecorded copy of a folder agent teamai's
    • 9436793 fix(agents): remove the copies of a namespace's agents once it holds AGENT.md
    • 23fef05 fix(skills): prove an unrecorded copy of a skill file teamai's
    • 3376b7e fix(skill): show a team skill kept as one file
    • f573904 fix(push): bring an unedited copy of a one-file skill up to date before push
    • 2bd164f fix(review): resolve a link to a skill kept as one file
    • 50ef78d chore(marketplace): say why a skill kept as one file gets no entry
    • 5ec552a test(resources): pin the order of a merged folder's files and when it took nothing
    • af17319 fix(agents): let pull prove an unrecorded copy of an agent folder teamai's
    • 203c3b2 fix(uninstall): remove the worktree's .teamai/ once its delivered folders are gone
    • 29f5173 refactor(resources): write the "holds , so it is one folder" note in one place
    • ff63d58 fix(push): sync a team skill before push as pull delivers it, frontmatter included
    • a726988 fix(dashboard): pair hand labels with an older rubric of a scorer folder
    • 28a3495 fix(push): push a scorer folder as one scorer
    • 75f8167 test(scorers): read a scorer folder in an undeclared scorers// as a file there
    • 8c83dde fix(team-ref): name a skill file, an agent folder and a rule folder when a ref change removes resources
    • 37b0c16 fix(push): propose an edit of a root agent that an inactive namespace's agent folder shares a name with
  • Review fixes, one commit each:
    • 0a57a09 fix(scorers): keep scorers/SCORER.md the scorer SCORER
    • a59d3dc fix(search-index): index a skill kept as one file when walking the skills tree
    • cc2c5d3 fix(workflows): hold a team folder over a default to 1 MB once merged
    • fbd9e92 fix(skills): keep notes under skills/ as notes; a skill file has a description
    • 2f7fca8 fix(review): name a skill kept as one file by its file in format findings
    • 389c3cd docs(changelog): record per-file defaults, agent and scorer folders, and the skill file form
    • 6f8162d fix(scorers): read scorers/SCORER.md as the file SCORER on the dashboard and when tried
    • 859b1fc fix(agents): keep an agent folder's delivered copy while a kept tool copy names it
    • 329b5f1 fix(scorers): name a tried scorer folder after its folder from inside it
    • 73e768d fix(scorers): read scorers/scorers/SCORER.md as the scorer folder scorers
    • 742b72f docs(changelog): drop the skipped scorer and agent folders from the folders entry
    • 92f8f8b fix(agents): keep an agent folder's delivered copy while any tool's copy names it
    • e7ec0c5 fix(scorers): try scorers/scorers/SCORER.md as the scorer folder scorers
  • Upgrade: a skill file needs a description in its frontmatter; any other .md under skills/ stays a note. TEAMAI_AGENT_DIR is now a reserved variable. A team folder named like a teamai default now takes every file it leaves out from the default; have every member upgrade before committing a folder that holds only some files, since an older teamai reads rules/teamai-recall/block.md as a rule of its own (CHANGELOG.md, Breaking).
  • Not in this PR, with the reason:
    • Push of a workflow folder: it pre-dates this change and is unrelated to inheritance.
    • list workflows shows a namespace's workflow as payments/release (not runnable) in the team repo listing. It does the same on main.
    • HTTP-mode agent and rule folders: the HTTP agent installs single files (above).

@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Preserve standalone SCORER.md identity — src/scorers/definition.ts:126: A valid existing scorers/SCORER.md is still discovered as the file-form scorer SCORER, but this parser now names it scorers. Pull caches it under the wrong name, so teamai score --scorer SCORER cannot find it. Pass the source form into parsing rather than inferring it solely from the basename.

  • [P2 non-blocking] Include file-form skills in whole-repo indexing — src/utils/search-index.ts:966: Only the explicit-source collector gains file support. collectSkillEntries, used for whole-repo indexing by viz, still visits directories exclusively. Consequently, skills/greet.md and skills/payments/greet.md disappear from that index despite being deliverable skills.

  • [P2 non-blocking] Validate the merged workflow’s size — src/workflow/cache.ts:412: Constructing a successful read directly from merged.files bypasses the 1 MB folder limit. A replacement narrative.md just below that limit passes its own validation, then inherits enough default files to exceed it and is nevertheless cached. Apply the size check to the resulting folder.

The supplied PR description documents sufficient testing, including representative real-CLI world runs at head 50226a8. No testing-record finding. No PR code 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.

Reviewed at 50226a82, running the same team-repo commits through a build of this head and of main (e266fd7e) in verify worlds. The inheritance itself works:

  • A team folder over a default gets the files it leaves out from teamai's version.
  • A stray file is warned about and left out, and review --branch fails on it.
  • Removing the override leaves nothing of the team's version behind.
  • ${TEAMAI_AGENT_DIR} expands in workspace and user scope, and converting an agent between a file and a folder, either way, leaves no stale copy. Uninstall cleans up both forms.
  • Scorer folders sync.
  • The per-file layer marks in list --json are right.

Several things I expected to break don't:

  • A stray file in a teamai-* folder without its marker was never delivered on main either.
  • The new push refusals and the refused scorer folder replace main's "cannot read yet" skips.
  • The removed skipped-folders surfaces only fired for folders this head now reads.

Two things block.

[P1 blocking] Notes kept under skills/ now become skills. Any .md directly under skills/, under a namespace folder, or under an ordinary sub-folder is now delivered to every member as a skill. Only README.md is excluded. Repro: a team repo with skills/NOTES.md, skills/CONTRIBUTING.md and skills/docs/guide.md. Main (and 0.30.0) deliver nothing. This head delivers skills named NOTES, CONTRIBUTING and guide, each with a made-up description: Notes, and review --branch gains three failures on files the team never meant as skills. Teams do keep notes there; that's why README.md is excluded. Suggested fix: treat skills/<x>.md as a skill only when it has frontmatter with a description, which review --branch already requires of a skill. Notes then stay notes, and there's nothing to disclose.

[P1 blocking] No CHANGELOG entry. 0.30.0 shipped the default folders and the skipped-folders warnings, so this PR changes released behaviour, and the CHANGELOG's entries for that work now describe things it removes. It needs entries for:

  • per-file inheritance of a default;
  • the file and folder forms (skills/<x>.md, AGENT.md, SCORER.md);
  • the removed skipped-folders doctor check, status list and dashboard panel;
  • the new push refusal;
  • the default scorer that only a file can replace.

Three changes that aren't in the body need a line too:

  • TEAMAI_AGENT_DIR is now a reserved team env name.
  • A lone rules/teamai-recall/<x>.md, which main delivered as a rule of its own, is now read as part of teamai's recall rule.
  • A partial override such as rules/teamai-recall/block.md reaches a member still on 0.30.0 as a standalone always-on rule (.claude/rules/teamai-recall/block.md). I ran that on the 0.30.0 build. Teams need an "upgrade every member before you add partial overrides" note.

[P3 nit] For a one-file skill, review --branch prints a path that doesn't exist (skills/NOTES.md/SKILL.md), and says pull needs frontmatter that pull actually generates.

Not checked here: an upgrade from an installed 0.30.0 that recorded skipped folders (the unit test covers it), resuming a workflow run across the upgrade (code read only), HTTP mode, and delivery to Codex, CodeBuddy and OpenCode.

A team that changed one text of a teamai default folder had to copy the whole
folder and from then on missed teamai's updates to every file it did not touch.

A layout can now say its folders inherit (`inherits`): a team directory named
like a teamai default folder is a folder even without its marker, and
`InheritedFolders.merge` lays its files over the default's. A file replaces its
whole language family (`problem.md`, `problem.zh.md`, `problem.en.md`). A team
file whose family the default lacks replaces nothing and is left out, unless
the team replaces the marker too. Workflows, hooks and rules turn it on.

Proved by table tests of the merge (marker inherited, language family,
subdirectories, strays, the marker allowing additions, dotted names that are
no language).
…lt's files

A team folder named like a teamai default now holds only the files it changes.
Pull checks the contract on the folder both make together: a default hook's
keys, ranges, texts and variables; the recall rule's kept files and lines; a
workflow's references. A refused result keeps teamai's default whole, as
before. A team file that replaces nothing is named in a pull warning and
left out, and `review --branch` fails it. A namespace replacement of a default
hook is still refused, now also when it holds only the files it changes.

A run of a workflow folder that inherited a file records the team commit and
the teamai version that gave the rest, and another machine refuses to continue
it as definition_mismatch when that version differs. Only the team's own files
are checked against the team commit.

The guide, the hook and recall READMEs and the glossary drop the copy-the-whole
-folder recipe. The guide's MR-learnings example copies both draft texts,
since a file replaces every language of it.

Proved red-first: a team hooks/teamai-friction-reminder/ holding only
problem.md was not even read as a folder on main; now pull delivers teamai's
other files with it and the Stop hint prints the team's text. Tests cover the
stray warning and review failure for each kind, recall folders holding only
block.md, a workflow folder over teamai-import-from-repo, and a claimed run
refused on another teamai version (seeded failure confirmed the check).
`teamai list hooks|rules|workflows` names a team folder over a teamai default
as `team, over teamai default <version> (<n> own files, <m> inherited)`, and
the new `--json` flag gives each file's layer. The dashboard shows the same
count on the folder and on a default hook it changes, and tags each file that
comes from teamai. `--json` leaves env out: `teamai env list` lists it.

Proved by list and dashboard tests over a hook, the recall rule and a workflow
folder that each hold one file of their own.
A team that wants an agent to read a rubric or examples beside it had no
way to ship them: AGENT.md was a reserved marker, and pull skipped the
whole folder. Agents could only be one file.

agents/[<ns>/]<x>/AGENT.md is now an agent named after its directory,
delivered to each tool that reads Markdown agents exactly as a legacy
agents/<x>.md is, with ${TEAMAI_AGENT_DIR} rendered to where that tool
reads the folder: the worktree's .teamai/delivered/agents/<x>/ in a
workspace (absolute for Claude Code, from the project root for a tool
that reads nothing outside it), the data home in user scope, with a
one-time warning for tools that may ask before reading there. The
per-tool path choice moves from RuleFolders.render into
DeliveredFolders.renderFor, so rule and agent folders share it.
TEAMAI_AGENT_DIR is a reserved team env name, as the other folder
variables are. Push proposes nothing from a folder agent's copies.

The skipped-folder tests that used an agent folder now use a scorer
folder, the type this release still skips.

Proof: agent-folders.test.ts (user, namespace, workspace with Claude
Code and CodeBuddy, the warning, push, the name clash) and the scan
tests failed before the change and pass after; the real-CLI E2E
pull-skipped-folders-1791 now delivers agents/reviewer/ in user scope
with the rendered path.
…cope directory

A delivered agent folder needs a way out and, in user scope, a way in
for Claude Code, which is denied a read outside the project unless the
directory is in permissions.additionalDirectories.

- Pull prunes the scope's agent folders once its agent cleanup ran,
  keeping those of the agents it resolved and any a copy left in a
  tool's agents directory still names (an edited copy the member kept).
  A collision that holds agents skips the prune.
- The user-scope grant now adds ~/.teamai/agents beside ~/.teamai/rules
  for a tool whose cell is grant and that receives agents, in the same
  checkout record, so uninstall takes both back.
- teamai remove agents <x> removes the team folder and the delivered
  folder with the copies.
- uninstall counts folder agents among the team's agents, so their
  copies go, and keeps a worktree's agent folder that a copy it leaves
  still names, as it does for rule folders.

Proof: the pull-level cases in rule-folder-grant-pull.test.ts (grant and
prune, the kept edited copy, teamai remove) and the uninstall cases
failed before the change and pass after.
Scorer folders are about to reuse WorkflowFolder.read, which reads a
folder as UTF-8 text with a 1 MB cap. Its size message said "a workflow
folder may hold", which would be wrong in a scorer diagnostic. The
message now says "a folder may hold"; the workflow diagnostic keeps its
"is not a valid workflow folder" prefix, so the workflow case reads the
same.

Proof: npx vitest run src/__tests__/workflow-folders.test.ts passes with
the updated expectation.
A scorer can now be scorers/[<ns>/]<name>/SCORER.md with files beside
it. SCORER.md is read as scorers/<name>.md is, and its prompt names the
folder's files through ${TEAMAI_SCORER_DIR}, spelled like
${TEAMAI_RULE_DIR}.

The judge reads only its evidence directory (the confined workspace of
teamai-score's judge step), so the files travel with the scorer rather
than being delivered under the data home:

- pull keeps every support file in the scorer's cache entry, and a run
  pins them with the rubric, so a later pull does not change what judges
  an open run;
- rubric.sourceHash covers the support files, so an edited file is a new
  rubric and re-judges; the team revision is recorded only when the
  commit holds every file of the folder;
- `score evidence` writes the pinned files to <evidence>/scorers/<name>/
  and renders ${TEAMAI_SCORER_DIR} to that path in the rubric and in
  prompt.md.

A folder holds UTF-8 text, no symlink, 1 MB in all, as a workflow folder
does. Pull refuses a scorers/<name>.md that names ${TEAMAI_SCORER_DIR},
and a folder named like a default scorer, whose replacement stays a file.
`teamai score --scorer ./scorers/x/SCORER.md` tries a folder with its
files. `review --branch` validates a folder as one scorer, ignores its
support files and any scoring.yaml in it, and `status` counts it once.
A later pull drops the cache entry of a removed folder.

Proof: red-first tests in folder-marker-scans, score-verbs (evidence
path, pinned support files, team revision), review-branch and
status-list; scorers-cache covers the refusals and the removal.
npm run typecheck, npm run lint and node scripts/check-docs.mjs pass.

With scorer folders read, no reserved folder type is left that this
release skips, so the skip scan of Tencent#1791 had no subject: pull, status,
doctor, review --branch, push and the dashboard no longer look for
skipped folders. A pull record an older release wrote with skipped
folders still forces one full sync, so a member who upgrades at an
unchanged team revision receives those folders at once, and pull no
longer writes the list. Push refuses to place a rule, agent or scorer
inside a folder of its type, which used to hold only for rule folders.
The guide now says only an older teamai skips a folder, and asks
members to update before the team adds an agent or scorer folder.

Proof: pull-upgrade-skipped-folders (fails when the record is ignored),
the pull-resource-folders E2E on the built CLI, and the full unit suite.
Skills were found by six hand-written walks of skills/ (the pull scan,
the push index, the namespace list, the role context, uninstall and the
agent view), each with its own idea of a namespace and of a skill. They
now share one read, readTeamSkills, built on Resources.survey with a
skills row in RESOURCE_LAYOUTS, so skills follow the same folder rules as
every other type with a marker file. SKILL.md is reserved in
FOLDER_MARKERS as a marker this release reads.

Skill resolution stays as it was: with roles, the active namespaces plus
tags; without, the shared root first. Only the read moved.

What changes:
- A namespace directory without SKILL.md is no longer an item of the
  pull scan. Pull still names it once a run, and review --branch still
  fails it, from the read's notSkills.
- Pull kept only the last team source of a name for its removal check,
  which relied on readdir listing a namespace before the root. It now
  checks against every team copy of the name.
- A declared namespace path that is a file still stops pull (ENOTDIR).

Proof: the skills, desired-skills, push, pull namespace, tombstone,
doctor, workspace, uninstall and review-branch suites pass. The full
unit suite failed only the review-branch and ENOTDIR cases this commit
then fixed. Two push --skill tests
modelled the team tree with pathExists/listDirs mocks; they now build a
real team tree on disk, since the read goes through the file system.
A skill that is only its instructions needed a folder holding one
SKILL.md. Now skills/<name>.md, or skills/<ns>/<name>.md, is that skill:
pull delivers it to each tool as <name>/SKILL.md, with its frontmatter
repaired, exactly as it would that folder.

- The skills layout reads .md files as skills, except SKILL.md, a
  README.md, hidden files and drafts. README.md stays out because team
  repos kept one in skills/ before a file could be a skill, and an
  upgrade should not start delivering it.
- A skill folder's name may not end in .md, so a team skill's path tells
  its form. TeamSkillSource answers what a skill delivers from either
  form; delivery, its record, the copy checks, cleanup, recall and the
  dashboard read the skill through it.
- A file and a folder of one name in one place define the skill twice:
  pull delivers neither and names both, and review --branch fails.
- Push sends an edit back to the file. Files the member added beside
  SKILL.md stay out, named, since a file holds nothing else.
- teamai remove finds the file as it finds the folder.
- review --branch checks a file-form skill's name and format.

An older teamai lists only directories under skills/, so it skips the
file and delivers nothing for it; the guide says to upgrade first.

Proof: new pull tests deliver a namespace skill file, leave README.md
out, replace a root folder with a namespace file whole, remove the copy
when the namespace goes inactive, and deliver neither of a file and a
folder of one name. The push scan and pushItem, review --branch and the
namespace scan gained file-form rows. Each new case failed before the
change. The full unit suite and the role skill push E2E pass.
The improvement page walked skills/ by hand for SKILL.md folders, so a
skill kept as skills/[<ns>/]<name>.md counted as a skill used outside the
team repo, and never as a team skill. It now reads team skills as pull
does, through readTeamSkills.

Proof: dashboard-improvement fails on the old walk (2 team skills, not 3)
and passes now.
… folder

The TOOLS cell ruleFolders and ruleFolderReachOf now decide how a tool
reads the files of a user-scope agent folder as well as a rule folder,
so they are folderReach and folderReachOf, and the generated Tool
support column reads "Rule and agent folder files". The stored
ruleFolderGrants key keeps its name: renaming it would need a
read-the-old-key path for state files already on disk, for no change in
what it holds.

Proof: npm run typecheck, npm run lint (generated pages regenerated),
and the full unit suite pass.
teamai remove and uninstall delete an agent copy with no delivery record
only when the team history proves it teamai's. The proof read the history of
agents/**/<name>.*, so a copy pull rendered from agents/[<ns>/]<name>/AGENT.md
was never proven and stayed behind as the member's.

The proof now also compares the copy with each version of the folder's
AGENT.md, rendered for the tool that holds it with its folder named where
that tool reads it. A copy the member edited still matches no version and
stays.

A removeItem case in agents.test.ts covers both: it failed before this change
because the rendered Claude Code copy was kept.
…AGENT.md

When agents/<ns>/ gains an AGENT.md it becomes one agent folder, and the
agents it held become its files. Pull stopped delivering them but left the
copies it had written in every tool, because agent copies only go on a
tombstone or a role change, and said nothing about why the agents stopped
updating.

Pull now removes the copies it delivered of those agents, as it does for a
rule folder, keeps one the member changed, and says why once:

  agents/<ns>/ holds AGENT.md, so it is one folder, and vr.md in it is one
  of its files, no longer read on its own.

An agent another place still delivers under the same name keeps its copy.
The guide and the troubleshooting reference describe the change.

A pull case in rule-folder-grant-pull.test.ts failed before this change: the
old namespaced copy stayed.
Without a delivery record (a lost record, the local agent's install,
doctor, Codex's shared directory), teamai proves a skill copy its own
when every file in it is a version of the team skill in the history.
The history it searched was skills/**/<name>/<file>, so a copy of a
skill kept as one file, skills/[<ns>/]<name>.md, matched nothing:
uninstall and remove kept it as the member's.

skillOrigin now names the file form too (CopyOrigin.skillFile,
skills/**/<name>.md), and the copy's SKILL.md is also checked against
it, with the same frontmatter render pull applies. The four places that
built a per-file origin for a skill copy share one helper.

Proof: a new ownsSkillDir case, for a skill kept as a folder and as one
file, proves an unrecorded copy teamai's and keeps an edited one; the
one-file row failed before this change.
`teamai skill show <name>` looked for a team skill only as a folder
holding SKILL.md, at the root or one namespace down. A skill kept as
`skills/[<ns>/]<name>.md` was found only through an installed copy, so
before a pull, or with no tool installed, it was reported missing, and
after one it was labelled from the copy instead of the repo.

The team lookup now reads the repo through readTeamSkills, the same
read pull delivers from: the root's skill first, then each namespace's,
in either form. The card reads the description from the file, prints
the file as the repo path, and the verbose line names it as SKILL.md.

skill-show.test.ts gains a row for each place, root and namespace; both
fail with "not found" before the change.
…re push

Before push, an unedited local copy of a team skill whose team version
moved on is brought to that version, so the scan does not read the
teammate's change as the member's edit. The team skills were found by
walking folders that hold SKILL.md, so a skill kept as
`skills/[<ns>/]<name>.md` was never compared: its stale copy stayed, and
push offered it back as a local change. The comparison also took the
local SKILL.md byte for byte, while pull writes it with the frontmatter
repaired, so a copy of a team file without frontmatter always looked
edited.

The sync now reads the team skills through readTeamSkills, the read
pull delivers from, and walks each one through TeamSkillSource, so the
file form compares and copies as `<name>/SKILL.md`. A local SKILL.md
counts as a team version when it holds it as the team has it or as
pull writes it. An edited copy is still left alone.

pre-push-sync.test.ts gains a case with a root and a namespaced
one-file skill: the unedited copy, as pull delivered it, is replaced
and the edited one kept. It fails before the change.
The branch review reads links between skills where pull delivers them:
each skill as `<skills>/<name>/`. A skill kept as `skills/<name>.md` is
delivered as `<name>/SKILL.md`, but the check looked for the link's
target inside the file's path as if it were a folder, so a link such as
`../greet/SKILL.md` to a sibling kept as `skills/greet.md` was reported
missing although it resolves for every member who receives both.

The check now resolves a target inside a one-file skill against what
pull delivers for it: its directory and its SKILL.md, nothing else. A
link to the file's repo path, `../greet.md`, is still reported, since
pull never delivers anything there.

The cross-skill link case in review-branch.test.ts gains a one-file
sibling with four links: the SKILL.md link failed before the change.
The marketplace refresh lists each root skill folder as a plugin whose
relative source is that folder. A skill kept as `skills/<name>.md` has
no folder to name: the plugin format takes a relative source only as a
directory inside the marketplace, and reads a skill only from a SKILL.md
in a skills directory or at the plugin root. An entry pointing at the
file would fail to install, so the refresh leaves such a skill out, as
it already did.

The comment at the scan now states that constraint, and the marketplace
test fixture gains a one-file skill, so the exact output it asserts
proves the skill stays out of the file.
… took nothing

Mutation testing of InheritedFolders left the file order list --json and
the dashboard show, and the boundary between a folder that took nothing
from teamai's default and one that took files, unpinned.

Proof: inherited-folders passes; the mutants that change the order or
the empty check are now killed.
…mai's

A copy's proof read one place in the team history. teamai remove and
uninstall checked an agent folder's AGENT.md as a second proof, but pull's
own checks (the tombstone pass, overwrite and stale copies) passed one
origin and never looked at agents/**/<name>/AGENT.md, so a copy pull
rendered from a removed agent folder stayed behind when its delivery
record was lost.

CopyOrigin now carries alternatives, other places a version of the copy
comes from, each proved as the origin is. agentOrigin adds the agent
folder, and the skill origin moves its one-file form, skills/**/<name>.md,
from its own field to the same list, so every proof checks every place.

Proof: a pull-tombstone case fails without the alternative (the rendered
copy stays) and passes with it, and keeps a copy the member edited; the
ownership, agents, skills, uninstall and pre-push-sync suites pass.
…ders are gone

Uninstall removed <worktree>/.teamai/delivered/ but left the .teamai/ that
held only it, an empty directory teamai created in the member's checkout.
It now removes that .teamai/ too when nothing else is in it; a self-mode
team, or anything the member keeps there, keeps it.

Proof: the uninstall case for a remote team's delivered rule folders now
checks .teamai/ itself; it fails before this change and passes after, and
the self-mode case still keeps the team content.
…note in one place

Rule folders and agent folders printed the same note from two copies of
the sentence. folderFilesNote in the resolver now owns it, and the agent
note calls it.

Proof: the rule folder, resolver and agents suites, which assert the note
verbatim, pass.
…tter included

The sync before push brought an unedited skill copy up to the team
version by copying the team files as they are, so a SKILL.md without
frontmatter, or a skill kept as one file, reached the tool without the
name and description pull writes, until the next pull. It now repairs the
frontmatter the way pull does.

Proof: the pre-push-sync cases now expect the copy pull delivers; the
first fails before this change ('v2 skill' without frontmatter) and all
pass after. The push and skills suites pass.
The Scorers page finds the values an older rubric listed by reading the
scorer at the label's team revision, but it looked only for
scorers/[<ns>/]<name>.md. Hand labels on a scorer folder's older rubric
fell back to the values their labels stored, so judges could pair
against the wrong rubric.

The lookup now also reads scorers/[<ns>/]<name>/SCORER.md at that
commit and hashes it with its support files the way pull does (CRLF
as LF, hidden entries skipped), so a folder's rubric hash matches.

The older-rubric pairing test now runs for a scorer file and for a
scorer folder in a namespace; the folder case failed before this change.
Since scorer folders are read, push saw each file of
scorers/[<ns>/]<name>/ as a scorer of its own. The check that refuses
to place a file inside a scorer folder then fired on the folder's own
files: an edit of a team folder's support file, and every file of a new
folder, stopped the push. Had it gone through, --role would have left a
new folder at the shared root, because each file sat one level deeper
than a scorer file.

Push now reads a scorer folder's files as that folder:
- placement, the shared-root checks, open-PR destinations and the
  folder check judge the folder, so a new folder lands whole in the
  namespace --role or --project names, and a file of a team folder
  goes back to it;
- a file added to a team folder is an edit of that scorer, not a new
  one;
- a selection that takes only part of a folder is refused;
- placement refuses a destination that already holds a scorer of that
  name in the other form, <name>.md or <name>/.
In self mode, a file the author adds to a folder an earlier push placed
goes into the placed folder.

Tests: push-role's --role case for a new folder, an edited and a new
support file of a team folder, and a partial selection; the placed-copy
case for a file added to a placed folder. Each failed before this
change. A real-CLI run on a git-mode team repo pushed a branch holding
scorers/ops/fresh/{SCORER.md,rubric.md} and the edited
scorers/strict/checklist.md. The same run before the change refused
both, and a second push found nothing to push.
The benchmark and scorer guides said a listed name needs a valid
scorers/<name>.md. A scorer folder, scorers/<name>/SCORER.md, defines
the name too: review --branch, pull and benchmark start check names
against the scorers pull caches, and that cache holds folders. Both
languages now name the folder, and the note on names with ":" says no
scorer file or folder has one.

The teamai-new-scorer lines keep scorers/<name>.md, since that workflow
writes the file form. Documentation checks pass.
…s a file there

A scorers/<dir>/ that no role or project declares is shared, so a
scorer file there reaches every member, and review --branch says so.
A scorer folder there, scorers/<dir>/<name>/SCORER.md, is handled the
same way by both: pull caches it as a shared scorer, and review reports
the same "sits at the shared root" note with the folder's SCORER.md as
the path.

These cases pin that. Both passed before any change, so this adds
coverage, not a fix.
…scription

A file directly under skills/ or a namespace folder became a skill, so
notes teams keep there (NOTES.md, CONTRIBUTING.md, skills/docs/guide.md)
reached every member as skills with a made-up description, and
review --branch failed on them. Only README.md was left out, and teams
keep other notes there too.

A skills/[<ns>/]<x>.md is now a skill only when its frontmatter has a
description, which review --branch already asks of every skill. Pull,
push, review, remove and the dashboard read skills through one reader,
and the search index and a ref change's removal names use the same rule.

The namespace pull test now keeps NOTES.md and a CONTRIBUTING.md with
other frontmatter beside a skill file; both were delivered as skills
before this change. Fixtures that used a skill file without a
description now give it one.
…ings

For skills/<x>.md, review --branch reported skills/<x>.md/SKILL.md, a
path that does not exist, and told the member to rename a directory.
It now names the file and says to rename the file.

The Agent Skills name test now holds a skill file; it printed the
SKILL.md path before this change.
…and the skill file form

The released notes still said a directory holding SCORER.md or AGENT.md
is skipped, and listed none of what replaces it: a team folder over a
teamai default inheriting the files it leaves out, agent and scorer
folders, a skill kept as one file, the skipped-folders warnings going
away, push refusing a file inside a folder of its type, and a default
scorer being replaced by a file only.

The breaking entries name what a team may trip over: a lone
rules/teamai-recall/<x>.md now joins the recall rule, TEAMAI_AGENT_DIR is
a reserved team env name, and a file under skills/ with a description is
a skill. The sharing guide now says, in both languages, to upgrade every
member before committing a partial override of the recall rule, since
an older teamai reads such a file as an always-on rule of its own.
@hz89Dev
hz89Dev force-pushed the feat/resource-folders branch from 50226a8 to 389c3cd Compare November 12, 2026 01:35
@hz89Dev

hz89Dev commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

All three are addressed in 389c3cd.

Notes under skills/ — fixed in fbd9e92. A .md under skills/ is a skill only when its frontmatter has a non-empty description. Everything else stays a note, wherever it sits: skills/NOTES.md, skills/payments/CONTRIBUTING.md, skills/docs/guide.md. The check applies to pull, review, the search index and the ref-switch removal list, so a note never shows up as a skill or as a removed one. Verified in a world built from 389c3cd with greet.md (described), NOTES.md and CONTRIBUTING.md: pull gives Synced 1 skills (1 new, 0 updated) new: greet, and review --branch on that branch gives 0 fail, 0 warn, 6 info. sharing.md (EN and zh-CN) now says that a skill file needs a description.

CHANGELOG — 389c3cd. Under Features: per-file inheritance, and agent and scorer folders. Under Changed: the removed skipped-folders surfaces and the one-time full sync, the push refusal, and the rule that a default scorer is replaced by a file only. Under Breaking Changes:

  • TEAMAI_AGENT_DIR is reserved.
  • A lone rules/teamai-recall/<x>.md is now part of the recall rule.
  • Upgrade every member before committing a partial override, because an older teamai reads rules/teamai-recall/block.md as an always-on rule of its own.
  • The skill file form, which needs a description.

I also corrected the old line saying a folder with SCORER.md or AGENT.md is skipped.

Review path for a one-file skill — 2f7fca8. Findings now name the file pull reads (skills/greet.md, not skills/greet.md/SKILL.md), and the rename hint says "skill file". After the fix above, a file with no frontmatter isn't a skill, so the "no YAML frontmatter" finding can no longer fire for one.

Not re-run here: HTTP mode, and CodeBuddy and OpenCode, which are left to CI as before.

@hz89Dev

hz89Dev commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

All three were real, and each is fixed with a test that failed first:

  • scorers/SCORER.md identity — 0a57a09. A SCORER.md counts as a folder marker only below scorers/<dir>/. At the scorers root it stays the file-form scorer SCORER, and the cache holds SCORER.json again (checked in a world at 389c3cd).
  • File-form skills in whole-repo indexing — a59d3dc. collectSkillEntries also indexes skills/<x>.md and skills/<ns>/<x>.md files that carry a description.
  • Merged workflow size — cc2c5d3. The 1 MB check now runs on the merged folder (WorkflowFolder.withinLimit). A team folder that is small on its own but over the limit once merged is refused, and the default stays in force. In the world: it holds 1063879 bytes, more than the 1048576 bytes (1 MB) a folder may hold.

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

Re-reviewed at 389c3cd6. The two blockers from the last round and the three points from the CI review are fixed. I rechecked them with a build of this head in a clean world:

  • skills/NOTES.md, skills/CONTRIBUTING.md, skills/docs/guide.md and a file with a blank description stay notes.
  • greet.md, a namespace ops/deploy.md and a file with a description but no name are delivered, and name is filled in.
  • A skills/<x>/SKILL.md folder is unaffected.
  • review --branch raises nothing about the notes.
  • Deleting greet.md removes greet on the next pull.
  • A root scorers/SCORER.md is the scorer SCORER again, cached as SCORER.json.

I read the index and merged-folder size fixes in the code, along with the team-ref removal naming and the push of a root agent shared with an inactive namespace's folder; they look right.

Two small edits left, both about the release notes:

[P1 blocking] The title needs !. The CHANGELOG now lists three breaking changes for this PR: the default-folder inheritance and recall <x>.md, TEAMAI_AGENT_DIR, and the skill file form. The title is still feat(resources): …. A breaking change needs both the CHANGELOG entry and the !, as #1804 did with feat(resources)!:, so the squash commit says so too.

[P1 blocking] CHANGELOG.md:12 still describes the behaviour this PR removes. In the same [Unreleased] section, the folders entry still says this release skips scorer and agent folders, that pull prints agents/reviewer/ is an agent folder, which this teamai cannot read yet, and that teamai status, teamai doctor and the dashboard list them. Line 70 now says those are gone, so the release notes contradict each other. Cutting that passage down to "SCORER.md and AGENT.md are reserved as well." resolves it. The line 145 fix was right.

[P3 nit] The try-scorer path still treats any file named SCORER.md as a folder, while pull now does that only below scorers/<dir>/.

CI was still running at this head when I looked: Windows and the budget checks passed, and nothing had failed.

@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Keep standalone SCORER.md file-form in remaining readers — src/dashboard/scorers.ts:229, src/scorers/try-scorer.ts:40: Both still infer folder form solely from the basename. For scorers/SCORER.md beside another scorer, the historical reader hashes the sibling files too, so it cannot recover the original rubric after an edit and drops valid human/model agreement pairs. Trying that file also reads the entire scorers directory and can fail because of an unrelated sibling symlink. Apply the source-form distinction already used by the parser.

The three earlier findings are resolved at their original sites: scorer cache identity, whole-repo skill indexing, and merged-workflow size validation.

The PR description documents sufficient representative real-CLI testing. No testing-record finding. No PR code was run, built, or installed.

…ard and when tried

The dashboard's older-rubric reader and trying a scorer file still took any
SCORER.md for a folder marker. For scorers/SCORER.md beside another scorer, the
dashboard hashed the siblings into the rubric and dropped hand-label pairs, and
trying the file read the whole scorers/ directory, failing on an unrelated
symlink there. Pull, the dashboard and the try path now share one predicate,
ScorerFolder.marks.

Proven by a dashboard row and a try case that failed before the change.
@hz89Dev

hz89Dev commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 6f8162d. Pull, the dashboard's older-rubric reader and the scorer try-out now share one check, ScorerFolder.marks, so scorers/SCORER.md is the file-form scorer SCORER in all three. Each change has a test that failed first:

  • The dashboard row with scorers/SCORER.md beside scorers/other.md paired 1 of 2 hand labels before the fix and pairs 2 now.
  • Trying scorers/SCORER.md beside a broken symlink returned scorer_invalid … gone.md is a symlink before the fix and plans now.

Checked in a world with the real CLI: teamai score --scorer ./scorers/SCORER.md returns SCORER from scorers/SCORER.md: styled (score 1, passed).

@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Parse tried scorers independently of the current directory — src/scorers/try-scorer.ts:61: From inside scorers/style/, trying --scorer ./SCORER.md reads the correct folder, but passes SCORER.md to the parser. The parser derives the name ., rejects it, and scoring fails. Derive the folder identity from the resolved source.

  • [P2 non-blocking] Keep support files for preserved agent copies — src/resources/agents.ts:1124: Removing a folder agent deletes its delivered folder before checking which tool copies must stay. An edited agent copy is subsequently preserved, but its rendered rubric path now points to deleted files. Prune the folder after removing copies, retaining folders that surviving copies reference.

  • [P3 nit] Distinguish a scorer folder named scorers — src/scorers/folder.ts:72: A valid scorers/scorers/SCORER.md is misclassified as file form because its parent is named scorers. Pull consequently caches it as SCORER, not scorers, and trying it omits its support files. Use the discovered source form rather than the parent basename.

The earlier findings are resolved for their reported scenarios. The PR description includes sufficient representative real-CLI testing, including at 6f8162d; no testing-record finding.

No PR code was run, built, or installed.

…copy names it

Removing a folder agent deleted its delivered folder before deciding which
tool copies stay. A copy kept because the member edited it, or because git
tracks it, then named a rubric that was gone. The delivered folder is now
removed after the copies, and only when none of them was kept.

Proven by the kept-copy case, which found the rubric deleted before the
change, and a new case that removes the folder when no copy is kept.
Trying ./SCORER.md from inside a scorer folder handed the parser SCORER.md,
whose folder is '.', so the try failed with 'the folder name must be a token'.
A tried file sits in no team repo, so the directory it is in and its name now
stand for its place in one, and diagnostics still name the path as given.

Proven by a try case run from inside the folder, which failed before.
…rers

ScorerFolder.marks looked at the parent directory's name, so a scorer folder
named scorers at the scorers root read as the file-form scorer SCORER. It now
takes a path in the team repo and keeps only scorers/SCORER.md as a file.

Proven by a row in the naming case, which named it SCORER before.
…olders entry

The same unreleased section now says pull reads scorer and agent folders and
that the skipped-folders warnings are gone, so the folders entry no longer
describes skipping them.
@hz89Dev hz89Dev changed the title feat(resources): change one file of a teamai default, and keep any kind as a file or a folder feat(resources)!: change one file of a teamai default, and keep any kind as a file or a folder Nov 12, 2026
@hz89Dev

hz89Dev commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Both release-note points are done:

  • Title: now feat(resources)!: ….
  • CHANGELOG.md:12: 742b72f cuts the passage down to "SCORER.md and AGENT.md are reserved as well." The entry no longer says the release skips scorer or agent folders or lists them in status, doctor and the dashboard. grep "cannot read yet" CHANGELOG.md finds nothing.

[P3] try-scorer and SCORER.md: fixed in 6f8162d and 329b5f1. Trying ./scorers/SCORER.md reads it as the file-form scorer SCORER. Trying ./SCORER.md from inside a scorer folder names the scorer after that folder. 73e768d restores the team-repo rule, so pull reads scorers/scorers/SCORER.md as a folder named scorers. A tried file sits outside the team repo, so the try-out names it by its parent directory, and only that case is still read as the file SCORER.

The same round also fixed 859b1fc: teamai remove agents used to delete an agent folder's delivered copy even when it kept a tool copy that names it. It now keeps the folder, as pull and uninstall already did. The world check is in the description.

@hz89Dev

hz89Dev commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

All three are fixed, each with a test that failed first:

  • Tried scorer named from inside its folder: 329b5f1. The try-out names a scorer by the directory it sits in plus its file name, and diagnostics still show the path as given. In a world, teamai score --scorer ./SCORER.md run from inside draft/style/ gives style from SCORER.md: styled (score 1, passed).
  • Delivered folder of a kept agent copy: 859b1fc. removeItem removes the delivered folder after the tool copies, and only when none of them was kept, as AgentFolders.prune already does on pull. In a world with a git-tracked .claude/agents/reviewer.md, the copy and .teamai/delivered/agents/reviewer/rubric.md both stay.
  • scorers/scorers/SCORER.md: 73e768d. ScorerFolder.marks takes a team-repo path again, so this is the scorer folder scorers, and only scorers/SCORER.md is the file form.

@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Preserve folders referenced by excluded-tool copies — src/resources/agents.ts:1164: After delivering reviewer to Claude Code, exclude Claude and run teamai remove agents reviewer --force. The tool loop skips Claude without setting keptCopy, then deletes the delivered folder. The preserved .claude/agents/reviewer.md now references missing support files. Check surviving copies, including excluded tools, before pruning.

  • [P3 nit] Preserve the full path when trying a folder named scorers — src/scorers/try-scorer.ts:59: Trying scorers/scorers/SCORER.md still constructs place as scorers/SCORER.md, which ScorerFolder.marks classifies as file form. Support files are omitted, and a rubric naming ${TEAMAI_SCORER_DIR} is rejected. The earlier fix resolves pull, but this reader still loses the distinction.

Resolved: earlier root-scorer identity/readers, whole-repo skill indexing, merged-workflow size validation, current-directory scorer parsing, and edited/tracked agent-copy preservation.

The PR description documents sufficient representative real-CLI testing; the older recorded head is not blocking. No PR code was run, built, or installed.

@SaulMoro

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Thanks. The title and CHANGELOG.md:12 are resolved, so both release-note points are closed. I read the round's code: ScorerFolder.marks shared by pull, the dashboard and the try-out, the folder-named try-out, and keeping an agent folder while a kept copy names it. It all looks right.

One thing before I approve. The CI review's new P2 is real:

[P2 non-blocking] teamai remove agents still deletes a folder that an excluded tool's copy names. In removeItem (src/resources/agents.ts:1123), an excluded tool is skipped before anything sets keptCopy, so the delivered folder goes. Pull doesn't do that: pruneAgentFolders reads copies through agentToolDirs, which doesn't filter excluded tools, and keeps any folder they name. So pull and remove disagree on the same copy. Repro: deliver reviewer as an agent folder to Claude Code, add Claude to the member's agent exclusions, then run teamai remove agents reviewer --force. The .claude/agents/reviewer.md is left in place, as it should be, but ${TEAMAI_AGENT_DIR} in it now points at deleted files.

The smallest fix that keeps the two in step is to prune the same way pull does. After the tool loop, read the copies in agentToolDirs and drop from folders any that DeliveredFolders.namedIn finds named. A keptCopy = true on an excluded tool whose copy exists would also do it, but it's a second rule for the same question.

The CI review's scorers/scorers/SCORER.md try-out case is a [P3 nit] and doesn't hold this.

…opy names it

Removing a folder agent kept its delivered folder only when it kept a copy
in a tool it writes to. A copy in a tool the member excluded is never
touched, yet its folder was deleted under it. Remove now keeps each folder
a file in any tool's agents directory names, excluded tools included, which
is the rule pull's prune already applies (AgentFolders.namedBy).

Proven by a case with the copy in an excluded tool, which lost the rubric
before the change.
A tried file was placed by its last two path segments only, so
scorers/scorers/SCORER.md read as the file-form scorer SCORER: its support
files were left out and a rubric naming ${TEAMAI_SCORER_DIR} was refused.
A path below the current directory now keeps every segment.

Proven by a try case of that folder, which was refused before.
@hz89Dev

hz89Dev commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Both are fixed, each with a test that failed first:

  • Copies in an excluded tool: 92f8f8b. removeItem now applies pull's rule: it keeps every delivered agent folder that a file in any tool's agents directory names, excluded tools included (AgentFolders.namedBy, which prune now shares). This also replaces the kept-copy flag from 859b1fc. In a world with Claude Code excluded after pull, teamai remove agents reviewer --force leaves .claude/agents/reviewer.md and .teamai/delivered/agents/reviewer/ (AGENT.md, rubric.md) in place.
  • Trying scorers/scorers/SCORER.md: e7ec0c5. A path below the current directory now keeps every segment, so it reads as the folder scorers with its support files. A bare ./SCORER.md or a path outside the current directory still falls back to its directory and file name.

@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Preserve standalone SCORER.md in namespaces — src/scorers/folder.ts:72: A valid file-form scorer at scorers/payments/SCORER.md in an active namespace is classified as a folder marker. Pull consequently caches it as payments, so teamai score --scorer SCORER cannot find it. Carry the discovered source form into parsing instead of inferring it from the path.

  • [P3 nit] Retain folder identity when trying from inside scorers — src/scorers/try-scorer.ts:59: From inside scorers/scorers/, trying --scorer ./SCORER.md still constructs place as scorers/SCORER.md, which is classified as file form. Support files are omitted, and ${TEAMAI_SCORER_DIR} is rejected. Preserve enough of the resolved path to distinguish this folder.

The earlier findings are resolved for their reported scenarios, including excluded-tool copy preservation and trying the repo-relative scorers/scorers/SCORER.md path.

The PR description documents sufficient representative real-CLI testing, including at e7ec0c5; no testing-record finding. No PR code 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.

Approving at e7ec0c59. The blocking points from the earlier rounds are resolved:

  • Notes under skills/ stay notes. I checked this in a world built from the PR.
  • The CHANGELOG covers the released behaviour this PR changes, under breaking changes, and the title carries !.
  • remove agents now keeps an agent folder whenever any tool's copy names it, through the same AgentFolders.namedBy check that pull uses.

On the latest CI review:

  • The namespace scorers/payments/SCORER.md case doesn't reproduce. Discovery (scorerCandidates) treats a directory that holds SCORER.md as the scorer folder payments, and never walks it as a namespace. So no file-form scorer SCORER exists in a namespace for the parser to misname, and SCORER.md is reserved, as the CHANGELOG says.
  • [P3 nit] Trying a scorer from inside scorers/scorers/ with ./SCORER.md, or trying a team's root scorers/SCORER.md from a directory above the team repo, still guesses the form from the trailing path. Neither holds this up.

@hz89Dev

hz89Dev commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Neither needs a change; reasons below.

  • scorers/payments/SCORER.md as a file-form scorer: not a valid form. A directory under a type's directory that holds its marker is one folder resource, at any depth. That rule comes from [feat] Reserve folder marker names so older teamai skips folders it cannot read #1791 and is listed under Breaking Changes in this PR's CHANGELOG. On main, src/folder-markers.ts already treats scorers/payments/ as a scorer folder there: 0.30.0 skips it whole with scorers/payments/ is a scorer folder, which this teamai cannot read yet. So no release ever read that file as the scorer SCORER. Pull now reads it as the folder payments, and scorers/SCORER.md at the scorers root is the only file-form SCORER. A namespace keeps a file-form scorer as scorers/payments/<name>.md.
  • Trying ./SCORER.md from inside scorers/scorers/: declined. A tried file sits outside any team repo, so from inside a directory named scorers there's no way to tell the scorers root (file SCORER) from a folder named scorers. The try-out takes the root reading. Trying the folder by its path from the repo root, scorers/scorers/SCORER.md, reads it as the folder with its support files (e7ec0c5). I'd rather not guess a team root for this one corner.

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