Repository navigation
feat(resources)!: let workflows, hooks, rules and MCP servers carry their own files as folders - #1804
Conversation
Each resource type finds its items by name with its own code: the workflow cache scans workflows/ and calls resolveNamespacedItems, and default-workflows.ts reads the package's defaults. Folders (Tencent#1787) need that lookup once, so every type gets the same file, folder and namespace rules. src/resources/resolver.ts exports Resources.list and Resources.resolve. A type declares its layout (directory, marker, file naming, an optional entry-list file); a tree holds the team's root and namespace layers, teamai's defaults, or both. The most specific layer wins as a whole, through resolveNamespacedItems, so replacement and conflict rules stay those of Tencent#707. A directory holding a marker this release cannot read is skipped, as Tencent#1791 made it. Workflows are the only registered type, and nothing calls the resolver yet. Verified with a table through Resources.resolve and Resources.list: default only, team root replaces the default, a namespace replaces the root, an inactive namespace is ignored, legacy mode, two active namespaces conflict, a file and a folder of one name are a duplicate, an entry in an entry-list file, plus folders in a namespace and in the package, and no namespace read for a root-only tree. A test checks that every registered layout's marker is reserved in src/folder-markers.ts. npx vitest run src/__tests__/resource-resolver.test.ts: 13 passed. tsc --noEmit and oxlint on both files pass.
The workflow cache scanned workflows/ and its namespaces itself, and DefaultWorkflows.named and all were a second lookup over the package's defaults. Both now go through Resources, so the folder slices change one lookup. syncWorkflowDefinitions lists the team's root and namespace layers with Resources.list. The manifest is still read only when workflows or prompts have a namespace on disk, and a manifest that cannot be read still activates no namespace. DefaultWorkflows keeps its contract (PREFIX, originOf, overrideProblems, guarded names) and exposes the teamai layer, which parses each shipped file once so a default keeps one definition object, as the retyped-input checks compare it by identity. loadCachedWorkflow, listCachedWorkflows, the reject warning, the reference checks, handoff's definitionsOf and the generated skill name resolve defaults through that layer. DefaultWorkflows.named and all are removed. The resolver reads teamai's package once per process, as the old loader did. The alias rules, alias_conflict, default_override_alias and the user-scope guard in resolveStart are unchanged. Verified: the 19 unit test files that import the workflow cache, default-workflows, namespace-resolver, handoff, workflow-skills or folder-markers pass before and after (749 tests each). An interleaved timing of default-workflows.test.ts and workflow-cache.test.ts against the previous commit shows no slowdown (34s, 34s before; 31s, 33s after). tsc --noEmit and oxlint on the changed files pass.
Workflow, hook, rule and MCP folders (Tencent#1787) all need the same walk: every file under the folder with its executable bit, hidden entries skipped, and a symlink or an unreadable path reported by name instead of silently left out, as readSuiteFiles does today. Tested by folder-files.test.ts (listing, symlink, unreadable).
… resolver An entry-list file that did not parse, or could not be read, resolved as a file with no entries, so a broken hooks/hooks.yaml would have dropped every team hook without a word. Team hooks are the first entry-list type to move onto the resolver, so the read now says why a file or folder defines nothing. - Resources.survey returns the resolutions and diagnostics: `invalid` for an entry-list file that does not parse or cannot be read and for a folder whose name breaks the layout's new `nameRule`; `note` for the notes an entry list gives and for a directory that gained the marker beside files its type reads, which become support files (common rule 1 of Tencent#1787). - Resources.layer reads one layer alone, for a type that applies its own rules to each item before the layers are resolved. - list and resolve take only a PlainLayout (no entry list, no name rule), so a type that can meet an invalid file cannot read it through them. Verified: resource-resolver tests (18), default-workflows and workflow cache namespace tests, typecheck, lint.
Team hooks are the next type to move onto the resolver (Tencent#1787 slice 3). The resolver now finds them: the entries of hooks/hooks.yaml and hooks/<ns>/hooks.yaml come from Resources.layer, and a file that does not parse or cannot be read comes back as its diagnostic, which still stops team hooks for the run. The entry policy stays in namespaced-entries, which MCP shares: per-entry roles: and unknown keys apply before the layers are resolved, legacy mode reads the root alone, and a workspace with children unions its members. A reader may now read a whole place (readPlace) instead of one file, so each entry carries the file or folder that defines it; env, secrets, MCP and models keep reading one file per place. review --branch reads a hooks file with parseTeamHooks. No behaviour change: the hooks, MCP, env, secrets, namespace, workspace children and review tests pass unchanged (28 files, 1405 tests), typecheck and lint pass.
A workflow can now be a directory, workflows/<name>/WORKFLOW.yaml with the files it needs beside it, at the team root or in a namespace (Tencent#1787). WORKFLOW.yaml is switched to supported in folder-markers, so the resolver hands the sync folder items and Tencent#1791 no longer skips them. The sync reads every file of the folder through FolderFiles and keeps them in the cache entry as UTF-8 text with LF line endings, with the executable bit git records (a file git does not track keeps the bit on disk). The entry's sourceHash covers every file's path, mode and content, so checkouts on Windows and on macOS hash the same folder alike. WORKFLOW.yaml's name must match the folder name. Another *.yaml in a folder is a support file, and pull prints one note per folder. A symlink, a file that is not UTF-8, or more than 1 MB in total is the coded diagnostic workflow_folder_invalid, which drops the last valid version. The code is added to the failure-code list lint checks. review --branch names a folder after its directory, so two folders in co-active namespaces no longer read as a duplicate "WORKFLOW", and it reviews no support file as a workflow. Tested by workflow-folders.test.ts (root and namespace discovery, the support-file note, symlink, non-UTF-8, size, git mode and LF hashing), review-branch.test.ts, folder-markers.test.ts and folder-marker-scans.test.ts, whose workflow cases now expect folders to be read. tsc --noEmit and npm run lint pass.
…plicate names Inside a workflow folder, prompt_file and the new answer_file name a file of the folder, relative to its root; subdirectories are allowed, and .. or an absolute path makes the workflow invalid. Outside a folder both resolve under prompts/ with the namespace lookup prompt_file has today. The sync inlines the text as the step's prompt or answer, as written, and checks its templates at the key's own field. answer_file is an answer-step action, so "a step has exactly one action" now lists it, and a workflow output bundle refuses it as it refuses prompt_file. A file and a folder of one name in one place (workflows/release.yaml beside workflows/release/) now say so: "defined twice in one place", with "Remove one of them" as the advice start prints, instead of the "multiple active namespaces" text every resolver conflict got. The conflict cache entry records the reason so start gives that advice. Both keep no runnable version and the code workflow_namespace_conflict. Tested by workflow-folders.test.ts (folder-relative and subdirectory paths, .. and absolute refused, answer_file through the prompts namespace lookup, duplicate), workflow-from.test.ts (bundle refusal), workflow-parse.test.ts and workflow-answer.test.ts. A seeded fault that accepts .. fails the refusal case. tsc --noEmit and npm run lint pass.
…cope Hook, rule and MCP server folders carry files their command or text names (Tencent#1787, common rule 9). Pull needs one owner for copying such a folder to the scope that owns it and naming its path: DeliveredFolders. - pathOf: ~/.teamai/<type>/[<ns>/]<name>/ for the user scope, ~/.teamai/projects/<slug>/<type>/... for a workspace with a remote team (shared by its worktrees), <worktree>/.teamai/delivered/<type>/... in single-repo (one per worktree). The path is the same for every version. - deliver writes a new version to a hidden sibling and renames it into place, leaves a folder that already holds the version alone, removes what an interrupted delivery left, and records each file in the delivery ledger. - prune removes the folders of a type the scope no longer delivers through removeDelivered. - render puts the path, with forward slashes and no quoting, in place of ${TEAMAI_<TYPE>_DIR} in one pass, or the path from a tool's project directory variable (common rule 10). Typed for hooks, rules and mcp; only hooks call it in this change. Verified: delivered-folders tests (12), typecheck, lint.
… delivered copy teamai/remove-delivered checked four listed files and flagged any call named remove(. A new delivery module, such as the resource folders of Tencent#1787, would escape it unless someone remembered to list it, and an unrelated remove (a Set's, a helper's) was flagged in the listed files. The rule now applies to src/pull.ts and every file under src/resources/, and reports only remove imported from fs-extra or src/utils/fs, by name, by alias or through the module's default or namespace import. The seven calls the wider scope reaches delete paths the delivery record never names (docs staging, a team env file, OpenCode's config, removeDelivered itself) and carry a disable with that reason. Verified: the rule's ruleHarness fixtures (10), typecheck, lint.
A team can now ship a hook as hooks/[<ns>/]<id>/HOOK.yaml beside the
scripts it runs. The hook's id is the directory name. HOOK.yaml takes a
hooks.yaml entry's keys without id, roles and projects, and its command
names the folder through ${TEAMAI_HOOK_DIR}. That variable is rendered,
in one pass and with forward slashes, to the path the scope delivers the
folder at, so the command stays the same across versions.
- requireTeamScripts lets a folder hook through when its command, before
substitution, names ${TEAMAI_HOOK_DIR}; other commands keep the
team-scripts rule.
- ${TEAMAI_HOOK_DIR} in hooks.yaml, a HOOK.yaml that does not parse, and
a hooks.yaml id beside a folder of the same name each stop team hooks
for the run and keep what is installed, as an invalid entry does
today. The duplicate is now caught in legacy mode too, and names both
sources.
- A teamai- folder replaces no default yet, so it is skipped with a
warning.
- Hooks held by autoApply are listed with their rendered command.
- The hooks marker is supported, so pull no longer skips hook folders.
Verified with the new hook-folder unit tests and the test files that
import the hooks resolver, namespaced entries and folder markers
(399 passed), plus typecheck and lint.
A run of a workflow folder stores the folder's files once per sourceHash under <dataHome>/workflows/folders/<sourceHash>/ and gives every step TEAMAI_WORKFLOW_DIR, the copy of the folder that defines the step. A nested workflow gets its own folder; a single file gets none. The copy stays for the run's whole life, whatever pull does to the folder later. - resume --claim rebuilds the folders on the claiming machine from the team commit the run ran at, or from this teamai's package for a default. - doctor --fix removes a stored folder once no run record and no cached workflow references it and it is an hour old. - teamai's own defaults may ship as folders. - status and list count a folder as one workflow named after it; push sends every file of a folder, not only its YAML.
Pull, init and hooks inject now write each team hook folder to the data home of the scope that owns it before any tool entry names it, and remove the scope's folders the team dropped. A folder that cannot be written keeps the installed team hooks for that run. A workspace that holds a hook back keeps its folders too. In single-repo, Claude Code's command names the folder through $CLAUDE_PROJECT_DIR ($env:CLAUDE_PROJECT_DIR when its hooks run under PowerShell), so a committed .claude/settings.json holds the same command in every worktree. TOOLS records the variable as hooks.projectDirVariable; other tools get the absolute path. The team hook history also reads committed HOOK.yaml versions, with the id from the directory and the current scope's path, so teamai still recognises entries it wrote from an earlier version. Verified with the new delivery tests (user scope, a new version, a dropped folder, single-repo, history) and the test files that import src/hooks.ts: 1859 passed; the 119 failures all come from os.userInfo() failing in the sandbox, in local-agent, which this change does not touch. Typecheck and lint pass.
…n benchmark arms - Pull warns of a confined step whose prompt names TEAMAI_WORKFLOW_DIR: a confined launch reads only its directory, so the folder may be out of its reach. - A benchmark arm refuses a workflow folder, its own or one it runs: a trial runs a bundle of copies, which carries no files beside the workflow. - Tests pin that the skill driver gives a command step TEAMAI_WORKFLOW_DIR, and that the skill generated for a folder leaves its README out.
- TEAMAI_WORKFLOW_DIR joins the reserved team env names, so no team value points a step at another folder. - Its path uses forward slashes on Windows too, and a test in the Windows job runs a command step through the platform shell from a data home path holding spaces and non-ASCII characters. - .gitattributes checks hooks/, rules/ and workflows/ out with LF, so a default folder's sourceHash matches on every system.
…ve them on uninstall A single-repo worktree delivers its hook folders in .teamai/delivered/, inside the team content the repository commits. DeliveredFolders.sync now runs one type's folders end to end: deliver, prune, and in single-repo keep .teamai/delivered/ out of git through its own delivered-folders block in .git/info/exclude. The block is written whatever sharing.gitExclude says, so git status, push and review --branch never see the copies, and its exclude file is recorded so uninstall finds it. Rule and MCP folders will go through the same call. A full uninstall removes .teamai/delivered/ and leaves the team content; a targeted --agent uninstall keeps it, since other tools still run the hooks from it. TEAMAI_HOOK_DIR joins the reserved team env names, and a test keeps "delivered" out of every resource type and layout directory. Verified with the delivery, hook-folder, delivered-folders, git-exclude-delivered and env-loader tests (357 passed) and the uninstall suite (242 passed; one failure comes from os.userInfo() failing in the sandbox, in local-agent). Typecheck and lint pass.
The Hooks section of the sharing guide now leads with the folder form:
the block-secrets tree and its HOOK.yaml, where each scope delivers the
folder, how ${TEAMAI_HOOK_DIR} is rendered (forward slashes, no
quotes), and $CLAUDE_PROJECT_DIR in single-repo. requireTeamScripts is
described as a provenance check, not a sandbox. The Windows page shows
how to quote the variable for Git Bash, Windows PowerShell and Node
from a home holding a space. The reserved-markers section says hook
folders are read. The admin skill names the folder form, and the
CHANGELOG has the entry.
Verified with node scripts/check-docs.mjs and npm run lint.
- The workflow guide gets a "Workflow folders" section, with the tree and WORKFLOW.yaml first, and documents TEAMAI_WORKFLOW_DIR next to TEAMAI_RUN_DIR. - The advanced guide covers answer_file, how a run keeps its copy of a folder, the limits, the confined-step warning and the benchmark arm limitation. - AGENTS.md and the engine notes name the folder form of a default workflow. - The docs example check pulls each `# workflows/<name>/WORKFLOW.yaml` example in a team repo of its own, with the files it names.
The Windows job now runs the delivered-folders and hook-folder unit tests, with a new case rendering a home that holds a space and non-ASCII letters with forward slashes. The Windows hook-shells E2E delivers a folder under such a sandboxed home and runs its rendered command under Git Bash, Windows PowerShell and node. Windows does not keep the executable bit, so a delivered folder now counts as current there when its paths and bytes match; otherwise every pull would rewrite folders whose files a test or a team marks executable. Verified on macOS: the unit files pass (22 tests), the E2E file collects and skips its 6 Windows cases, typecheck and lint pass. The Windows cases themselves run only on the CI windows job.
teamai-import-from-mr, teamai-codebase-deep-enrich and teamai-import-from-repo are about to move their answer texts into files of their own. These fixtures pin what each answer step gives the tool today, so the move can be checked to change nothing. - Each default runs on the local driver with stand-ins for teamai and claude, for fixed inputs: both languages of teamai-import-from-mr, one component with architecture and scenarios for the deep enrich, one narrated item for the repo import. - Every text the tool reads is compared byte for byte with a file under fixtures/default-workflow-prompts/. Verified: the test passes on the single-file defaults, and fails when a fixture gains a trailing newline.
…oday The recall rule and its two instruction blocks are about to move from TypeScript constants into the teamai folder rules/teamai-recall/. With no team replacement they must stay byte-identical for every language value. Capture them from the current code, for language unset, en and zh: the rule deployBuiltinRules writes, and the blocks resolveInstructionBlocks gives pull and the session hook. The fixtures are LF in .gitattributes so the comparison holds on Windows too. Verified: the new test passes against the current code (6 cases).
The friction reminder, the merged-MR hint, the TodoWrite hint, the session-start env hint and the package hint are about to move from TypeScript constants into hook folders a team can replace. This captures what each prints today, through the builders the hooks call, as a fixture: 26 cases, each for language unset, en and zh. With no team replacement each must stay byte for byte the same afterwards. The friction reminder, the env hint and the package hint read no language today, so their three entries per case are the same text. Verified: the new test passes against the current code (26 tests).
A default shipped as a workflow folder kept prompt_file and answer_file unread: readDefault parsed WORKFLOW.yaml but never put the files' text into the steps, so the local driver got a lease it could not run. A team folder did not have this problem, because pull reads the files. - resolveFolderFiles (parse.ts) reads each prompt_file and answer_file of a definition, inline workflows included, from a folder's files and checks their templates. - Pull uses it for a team folder, in place of the same walk it did inline, and readDefault uses it for a default folder. A default whose file is missing or whose template does not check is a teamai bug, so it throws, as a default that does not parse does. Verified: the new workflow-folders test fails without the change (the steps have no prompt or answer) and passes with it.
teamai-import-from-mr, teamai-codebase-deep-enrich and teamai-import-from-repo carried long answer texts inline in their YAML, so a team that wanted to change one prompt had to copy and keep the whole file. Each is now a folder a team copies and edits like its own. - Every inline answer moves to a file of the folder, through answer_file: draft.en.md and draft.zh.md (still chosen by inputs.language), component.md, architecture.md and scenarios.md, and narrative.md. The files hold the parsed text exactly, with no trailing newline, as the block scalars gave it. - Each folder has a README.md: the files, inputs, outputs, related settings and how to replace it. - No file is executable, so the folder hashes the same on every system. Verified: the fixtures of the texts each answer step gives the tool match byte for byte after the move, and npm pack --dry-run lists every file of the three folders.
- "Default workflows" names the three defaults that are folders and their files. - "Override a default" copies teamai-import-from-mr whole, adds a section to draft.en.md, and pushes it. - CHANGELOG entry.
Rules are named by their path at any depth (rules/fe/style.md is fe/style), so the one-level layers survey and layer read do not fit them. Rule folders (rules/fe/style/RULE.md, also fe/style) need the same discovery the other folder types get: the marker matched against readdir names, a folder's files kept out of the item list, a file and a folder of one name reported as a duplicate, and the rule 1 note when a directory that held items gains the marker. Resources.walk gives that for a layout, and RESOURCE_LAYOUTS gains rules (RULE.md, any .md a rule). Files are read as the rules scan read them, so the switch to it changes nothing for file rules. The note leaves out the marker's language variants (RULE.zh.md), which are the folder's own text. Verified: resource-resolver.test.ts 21/21. The duplicate and note cases passed on their first run, so I broke each in turn and saw it fail.
pruneWorkspaceDirs decided which `workspaces/<id>/` directories belong to gone checkouts and removed them in one step. Hook records live in those directories too, and the hooks pass needs the same answer, with the checkout's root, before the directory goes. staleWorkspaces now returns each stale directory with the root its `root` file names; pruneWorkspaceDirs removes what it returns. No behaviour change: partition, submodule-checkout and the other importers pass.
A single-repo worktree's ZCode and bridged-tool entries live in HOME, gated to the worktree, and run the hook folders it delivered in its own `.teamai/delivered/`. Removing the worktree left them there for good: a full pull pruned the worktree's `workspaces/<id>/`, and with it the records that name them, before the hooks pass ran. releaseRemovedCheckoutHooks reads each stale workspace's hook records and removes its gated entries from HOME, team entries only. Pull calls it before pruning, the hooks pass calls it for the fast path, and so does doctor --fix. The gate names the checkout's realpath, taken while it existed, so the removed root is resolved through its nearest existing ancestor. Tested by a unit test through reconcileTeamHooksForConfig and an E2E with two real worktrees: a full pull of the remaining worktree and doctor --fix each leave no entry naming the removed one, and each worktree runs its own branch's script.
teamai's hints kept their texts and thresholds as TypeScript constants,
so no team could change them. They now live in five folders of the npm
package, laid out as a team's own hook folders are: hooks/<name>/ with
HOOK.yaml holding `with:`, and one file per text, `{{ name }}` marking
a variable:
teamai-friction-reminder min_tools, min_score, weights, tool-error
tiers and bonuses (the CONTRIBUTE_* values);
the headline, task and action texts
teamai-mr-hint lookback_days, max_mrs; offer-command and
offer-workflow, with .en.md variants
teamai-todowrite-hint message, with an .en.md variant
teamai-env-hint variables, secrets, exec, secrets-rule
teamai-package-hint message
src/default-hooks.ts keeps the contract of each folder in code: the
parameters with their ranges and the variables each text offers. It
reads a folder with CRLF read as LF and one trailing newline dropped,
picks <text>.<language>.md over <text>.md, and fills variables in one
pass. The handlers keep their logic and build their text from the
folder; the older entry points share the same builders. The package
files list gains hooks.
Verified: the golden texts captured before this change match byte for
byte (26 cases, three languages each); the 28 test files importing the
changed modules pass apart from the 118 local-agent tests that fail on
this machine without the change (os.userInfo()); typecheck and lint
pass.
A team can now ship a stdio MCP server as mcp/[<ns>/]<name>/MCP.yaml
beside the files it runs, so a script server no longer needs a separate
package or install step. The server's name is the directory name, under
the MCP name rule (letters, digits, - and _). MCP.yaml takes an mcp.yaml
server's keys without name, roles and projects. ${TEAMAI_MCP_DIR} in its
command, args and env is rendered, in one pass and with forward slashes,
to the folder's path in the data home of the scope that owns it; headers
are left as written.
- Pull, mcp inject and every other command that applies team MCP write
each folder to that data home with DeliveredFolders.sync before any
tool config names it, and remove the
scope's folders the team dropped. A folder that cannot be written keeps
the installed team MCP servers for that run. A workspace that holds a
server back keeps its folders too.
- The rendered server goes to every tool config that mcp.yaml reaches.
requires: and sharing.mcp.allowedCommands apply to it as to any other
stdio server, so the runner (uv, node, npx) is what they check.
- In single-repo the folder lands in .teamai/delivered/mcp/ and the tool
config gets its absolute path. Claude Code does not expand
$CLAUDE_PROJECT_DIR in .mcp.json, so TOOLS gains no MCP variable.
- An http or sse folder, ${TEAMAI_MCP_DIR} in mcp.yaml, an MCP.yaml that
does not parse, a refused folder name, and an mcp.yaml server beside a
folder of the same name each stop team MCP for the run and keep what is
installed, as an invalid entry does today. A teamai- folder is skipped
with a notice, since teamai ships no MCP server it could replace.
- A directory holding any folder marker is never read as a namespace, so
mcp.yaml scans no longer descend into a server folder.
- TEAMAI_MCP_DIR is reserved, so no team env value can shadow it.
Verified with the new MCP folder unit and delivery tests (two workspaces
bound to different teams each start their own server, user scope,
single-repo with git status clean, requires, allowedCommands, dry run, a
dropped folder, an invalid folder keeping what is installed) and the 302
test files that import the touched modules: 2404 passed. Of the 148
failures, 140 are local-agent MCP and model-config tests that fail
identically on the parent commit, from os.userInfo() failing in the
sandbox, and 1 is uninstall for the same reason; the other 7 were
mcp-cmd fixtures on the old shape, now fixed (13 passed). Typecheck and
lint pass.
Reading CRLF as LF only for UTF-8 text still split members: Git for Windows applies core.autocrlf to every file it treats as text, so a .bat saved in GBK got another version on Windows than on macOS, and in single-repo the committed .claude/settings.json flipped between them. A file git tracks and the checkout has not changed now counts by its committed mode and blob id, which every checkout of a commit shares, whatever autocrlf, fileMode or the encoding. A file the author has not committed yet counts as it is on disk. One `git ls-files` per folder tells them apart. Pull no longer copies the files git ignores, so a version covers exactly the files it delivers. Outside git every file counts as it is on disk, and a git failure now stops the folder with git's error instead of giving another version without a word.
|
The P1, the P2 and the first nit from the review at
I kept untracked files in the version, as you suggested, so an author's uncommitted folder still versions. A member's own stray untracked file in a committed folder, such as [P3 nit] Real CLI, in the description: the team adds a GBK Checks at Could you take another look? |
Thanks. Versioning by git's blob ids fixes the GBK case and the mismatch between version and delivery. [P2 non-blocking] Nits, for your judgement:
|
A folder's version and delivery kept only the files git ls-files names by their own path. A submodule is one gitlink record and a repository of its own one `? dir/` record, so a team that vendors an MCP server as a submodule got only MCP.yaml delivered, and the server failed with "file not found". Nothing was printed. Pull now refuses such a folder, checked out or not, and names it: "mcp/jira/ cannot be delivered: server/ is a git submodule". Any other file git neither lists nor ignores refuses its folder too. Paths compare in NFC, so a name macOS holds as NFD on disk still matches the index. A file git is told not to check (assume-unchanged, skip-worktree) counts as it is on disk, so editing it gives a new version rather than rewriting the old one in place.
|
The P2 and two of the three nits from the review at
The not-checked-out case came from the real CLI. The pull of the first version of this fix delivered [P3 nit] Turning Checks at Could you take another look? |
Earlier findings: The previously reported exact repros are resolved in the current diff; this finding concerns another retention path. Testing: The description documents sufficient build and representative real-CLI/E2E verification. Older recorded commits are not blocking. Nothing from the PR was run, built, or installed during this review. |
Thanks. Refusing a folder git can't list fixes the submodule case, and it fails closed: hook and MCP callers keep the installed version and its configuration, and the message prints once per pull. A single-repo author's untracked files still deliver as they are on disk, and both sides of the comparison are in NFC. One case left: [P2 non-blocking] On the CI review's file/directory clash ( Nits:
|
A rule folder keeps the files an earlier version had, but where the team turns a directory into a file of the same name, or back, the new version takes the path and the earlier files under it went without a word. A rule copy the member edited, which pull leaves as it is, could still name one and fail with ENOTDIR. The new version still wins, as every copy this pull writes names it; a folder cannot hold both. Pull now names the earlier file that went and what took its place, so the member can update the copy they kept.
Earlier findings: The other previously reported exact repros are resolved; they are not raised again. Testing: The description documents sufficient build and representative real-CLI/E2E verification. Older recorded commits are not blocking. Nothing from the PR was run, built, or installed during this review. |
|
[P2 non-blocking] Rule folder file/directory clash: addressed in A rule folder keeps one path across versions, so it cannot hold both The warning comes once, on the pull that makes the change. Test: |
On the CI review's repeat of the file/directory clash at The only item still open from my review is the nested repository under an ignored directory ( |
`git ls-files -o -i` does not descend into a repository of its own: a clone under an ignored directory is one record, `build/vend/`. Its files then matched no ignored path, so pull refused the folder, naming each of them as "neither tracked, new nor ignored". An ignored record ending in `/` now covers everything under it. The refusal names at most three files and how many more. The guide says that a rule folder keeps a file the team removes, and that a path the team turns from a directory into a file, or back, goes to the new version, with pull naming the file that went.
|
The P2 and both nits from the review at
Real CLI, in the description: with Checks at Could you take another look? |
Earlier findings: The other previously reported exact repros are resolved; they are not raised again. Testing: The description provides sufficient build and representative real-CLI/E2E records. Older recorded commits are not blocking. Nothing from the PR was run, built, or installed during this review. |
Thanks,
|
`teamai review --branch` skipped two kinds of folder this branch adds. A replacement of a default hook, such as hooks/teamai-friction-reminder/ with `with.min_tools: 5000`, gave no finding, though pull refuses it. And the leak scan never read rules/teamai-recall/, so a credential in a recall replacement's block.md passed review and went into every member's instructions. Review now fails each replacement of a default hook pull refuses, with what pull prints, and scans the recall folder for credentials and internal addresses like the other rules. Pull and review read default hook folders through one function.
Earlier findings: Recall-replacement credential scanning and default-hook replacement validation are resolved in the current diff; they are not raised again. Testing: The description documents sufficient build and representative real-CLI/E2E verification. Older recorded commits are not blocking. Nothing from the PR was run, built, or installed during this review. |
|
Both new P2s from the review at
Real CLI, in the description: Checks at |
Each hook-dispatch hands its event to a detached child and exits, and the Tencent#809 test read events.jsonl as soon as the last hook returned. On a slow runner the last session's child had not written yet, so "records every session" missed api-personal (CI shard 1, twice on this branch). The test now waits for the detached children, as the helper is for.
Earlier findings: The other previously reported findings are resolved and are not raised again. Testing: The description documents sufficient build and representative real-CLI/E2E verification. Older recorded commits are not blocking. Nothing from the PR was run, built, or installed during this review. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Approving at 70ccbab. Everything that blocked is resolved:
-
Reserved env names.
TEAMAI_WORKFLOW_DIR,TEAMAI_HOOK_DIR,TEAMAI_RULE_DIRandTEAMAI_MCP_DIRare listed under Breaking Changes, with what a team that sets one should do (aedb1f92). -
Symlinked folder root. A hook, rule, MCP or workflow folder that is itself a symlink gets a diagnostic. For workflows that diagnostic is
workflow_folder_invalid, andreview --branchnow follows such a link within the branch (11771a56,4c36235c). -
MCP folders of kept servers. Pull now works out which servers keep their installed configuration before it delivers any folder: a server a workspace holds back, a server whose declared secret is not set on this machine, and every server when secrets cannot be read. Each of those keeps its folder as it is (
245f5a44,57b62740). -
Backup removal. If an old version cannot be removed after the swap succeeds, pull only warns. What was delivered is recorded, and the new hook and MCP configuration are still applied (
c5684720). -
Edited rule copies. A rule folder stays while any tool still holds a copy of that rule, including OMP's flat names. A kept edited copy also keeps the files the new version dropped. The data-home folders and their worktree copies are written in one delivery (
aa382b70,99185726). -
Dashboard. A
teamai-workflow folder that pull skips now shows as refused, and so do a server or hook the team's policy refuses, each with pull's message (ca9d0e27,c97cbaa3). -
MCP ownership history. Past versions of each committed
MCP.yamlnow count during recovery (01406b64). -
Workflow folder leaks check.
review --branchnow reads every file in a workflow folder, the same as for hook, MCP and rule folders (5d8f65c4). -
Shared folders across worktrees. In a project, rule and MCP folders are now delivered to each worktree's
.teamai/delivered/. A pull in one worktree no longer changes what another worktree runs or reads (f2742b72). Remote-team hooks stay shared, which is correct, since every worktree runs the same hook entries. The single~/.claude.jsonlocal-scope entry is listed under Limitations. -
Failure-path P2s. Excluded targets keep their servers' folders, and a folder keeps the files an earlier version had (
a8d35457). -
Prune after the configuration. MCP folders are now placed with their previous version set aside. A failed configuration write puts the folders back along with the configurations. Prune runs only after every write, and keeps any folder an installed entry still names: a kept, held or excluded server, including one the team moved to
mcp.yaml(c674de89,a6e32428). A failed MCP reconcile now gives a warning instead of going only todebug.log(14ba3f04), and this is listed under Bug Fixes. -
Earlier files. Your reason for keeping them holds: an edited rule copy or an excluded tool stays on the old version on purpose, beyond any one run. A folder that replaces a default hook now holds only its current files. Case-only renames are told apart where the disk can hold both names, and every delivery site has to declare
earlierFiles(19165a0f). -
Hermes inline rules. A pull that could not rewrite every inline block keeps every delivered rule folder (
c674de89). -
Retention from what survives. Once writes are done, MCP prune keeps the folder of every server some tool's file still holds an entry for (
f9c54edb). Hook folders are pruned after every tool's entries are written, keeping each hook a manifest of the scope still records (18ed8e8e). Inline rule files are written afterRuleFolders.sync(10e10703). -
teamai remove ruleson a folder. It removesrules/<name>/from the team repo, and checks each tool's copy against the text pull renders for that tool (10e10703). -
Versioned hook and MCP folders. A hook or MCP folder sits at
<name>.<version>/, where the version hashes the whole definition, and stays while any surviving entry names it. The prune decodes CodeBuddy's Windows gate command before matching. An unchanged definition keeps its version: keys are sorted, the schemas have no defaults, and${VAR}is hashed before it is filled in (a042b9a8,64fc4ac3,02f0ad66). Rule folders keep one path and are the only ones that still keep earlier files. -
Uninstall. Delivered folders go last. A folder that a file uninstall leaves still names is kept, judged per worktree, and named in a warning. Every MCP folder is kept when an MCP file cannot be read (
57532843,c8cdfafc). -
Same version on every machine. A tracked, unchanged file counts by its index mode and blob id, and a new or edited one by its bytes on disk. Paths compare in NFC, and ignored files are neither versioned nor delivered. So a GBK
.bat,autocrlf,fileModeand each member's own excludes give one version per team commit (54f02644,80b45408). -
Folders git can't list. A submodule, a nested repository that git doesn't ignore, or any file git neither lists nor ignores refuses the folder, with a message, and the installed version stays (
41811c09,1104e40e). -
Rule path clash. When the team turns a directory into a file, the new version takes the path and pull names the file that went.
sharing.mdsays so in both languages (41b13772,1104e40e). -
Uninstall and CodeBuddy. Uninstall decodes CodeBuddy's project-gate command and reads its settings as JSONC (
4ad6f49c,a2fc686f). -
review --branchchecks what pull checks. It now runs the leaks check over the recall replacement folder, and reports a default-hook replacement pull would refuse (f57b27af). -
The worktree attribution E2E waits for the hooks' detached writers before it reads events, so the last session no longer races the assertion (
70ccbab3).
|
@SaulMoro both gaps from your comment are fixed in |
Summary
A team could share a workflow, hook, rule or MCP server only as one file. A workflow's script, a hook's scanner, an MCP server's code and a rule's detail had to live somewhere else, and teamai's own prompts, hint texts and thresholds were constants no team could change. Now each of these can be a folder, the way a skill already is: a marker file and the files it needs next to it. One layered resolver finds them all (teamai default, then team root, then active namespace).
A team repo can now hold:
After
teamai pull:<data home>/workflows/folders/<sourceHash>/, stored when a run startsTEAMAI_WORKFLOW_DIRin every step's processes. The run keeps that copy whatever a later pull does.resume --claimrebuilds it on another machine~/.teamai/hooks/block-secrets.e246f037/,~/.teamai/projects/<slug>/hooks/..., or.teamai/delivered/hooks/...in each single-repo worktree. One directory per version of the folder's files (e246f037: the first 8 hex digits of the SHA-256 of each file's path, mode and git blob id,HOOK.yamlincluded). Every checkout of a commit gives the same version: a committed file counts as git stores it, whatevercore.autocrlf,core.fileModeor its encoding, and a new or edited file as it is on disk. Pull copies no file git ignores, and refuses a folder holding a git submodule or a repository of its own. A version's files never changebash "<that path>/scan.sh", forward slashes. A tool whose settings pull cannot rewrite, or one the member excluded, keeps the files of the version it holds. In single-repo, Claude Code gets$CLAUDE_PROJECT_DIR/.teamai/delivered/...problem.mdand waits for 30 tool calls.teamai/delivered/rules/api-style/in each worktree; in user scope~/.teamai/rules/api-style/, granted to Claude Code throughpermissions.additionalDirectories(uninstall removes it)api-style.mdin the tool's rules directory, with the path in place of${TEAMAI_RULE_DIR}.teamai/delivered/mcp/notes.<version>/in each worktree; in user scope~/.teamai/mcp/notes.<version>/. One directory per version of the folder's files, as for hooksnode <that path>/notes.mjsfor every toolmcp/mcp.yamlreaches. A tool whose MCP file pull cannot rewrite, or one the member excluded, keeps the files of the version it holdsSUITE.yamlis read likesuite.yaml; both in one directory is invalidAlso in this PR:
teamai-import-from-mr(draft.en.md,draft.zh.md),teamai-codebase-deep-enrich(component.md,architecture.md,scenarios.md) andteamai-import-from-repo(narrative.md). Golden tests check the text is byte-identical to before.teamai-friction-reminder,-mr-hint,-todowrite-hint,-env-hint,-package-hint), and teamai's recall rule ships asrules/teamai-recall/. A team replaces any of them with a folder of the same name at the root of its repo.teamai review --branchchecks hook, MCP and rule folders as pull reads them, fails a replacement of a default hook or of the recall rule that pull refuses, and scans the recall replacement for credentials like the other rules.teamai remove mcpandteamai remove rulesremove a server or rule folder.teamai uninstallremoves teamai's copies of a rule folder. It keeps a delivered folder that a file it leaves still names, and says which file: a member's or edited rule copy in any worktree, or an MCP or hook entry it could not remove.workflows/,agents/andscorers/at the package root, has aREADME.mdand aREADME.zh-CN.md. Each shows in tables and Mermaid decision trees what a team can change, what the resource reads and gives, what pull refuses, and which settings change it. It links the guide for defaults and full texts instead of copying them, so a change to a default does not need a README change. The package directoryagents/now holds READMEs, so teamai deploys only its own agents from it (edb22d2fa).assets/todocs/assets/, and every root README links them there (5d1d7732f). The root READMEs change only in those<img>paths.14ba3f04d). Since feat(mcp): distribute team MCP servers as a seventh resource type #252 it wrote that only to~/.teamai/debug.log, so a.mcp.jsonit could not write read as a pull with nothing to change.What members see, verbatim from the code:
How pull delivers a type's folders (hooks, rules, MCP servers), so the installed entries always match them:
Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest run <test files>); the fullnpx vitest runpasses if the change touchessrc/__tests__/helpers/, avitest*.config.ts,package.jsonorpackage-lock.json. CI runs the full suite on every push to a PR.The branch touches
package.jsonandsrc/__tests__/helpers/windows-tests.ts, so I ran the full unit suite. Its only failures are nine OpenCode doctor checks that fail only under the full parallel run (below); CI is the authority for those files.Verification
Local checks at
9bdf7677a(macOS):tsc --noEmitand the lint plugin project, TypeScript 7.0.2)npm run lintDocumentation checks passed.npm run buildnpm run test:e2eon the 6 files that drive folder delivery, skips and uninstall (hook-folder-worktrees,hook-shells-windows,pull-skipped-folders-1791,git-exclude-uninstall-915,managed-resources-uninstall,workflow-team-workspace)doctor-rules-delivery.test.ts, which this branch does not touch: they fail only when the whole suite runs in parallel, did so onmaintoo, and the file alone passes 80 of 80After merging
mainat5d687270b(#1798 to #1801): type check,npm run lintandnpm run buildexit 0; the full unit suite has 23209 passed, 27 skipped, and the same 9 parallel-only OpenCode doctor failures plus one test of this branch that needed recall on, since #1801 gives the TodoWrite hint only then (fixed in the merge).npm run test:e2eonhook-fast-path-1788,hook-folder-worktrees,pull-skipped-folders-1791andgit-exclude-uninstall-915: 33 passed. The hints a default hook folder replaces run atsession-startandStop, or in the full dispatch for TodoWrite, so #1801's fast path leaves them as they were.After the review at
9bdf7677a, at4c36235cf: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed since5d687270b(vitest-affected, 11012 tests) have 11000 passed, 3 skipped, and the same 9 parallel-only OpenCode doctor failures; that file alone passes 80 of 80. The real-CLI record for a symlinked folder follows the every-type record below.At
01406b649, after the second round of review: type check,npm run lintandnpm run buildexit 0, andvitest-affectedsince5d687270b(11816 tests) has 11804 passed, 3 skipped, and the same 9 parallel-only OpenCode doctor failures (80 of 80 alone).435048d79adds only README files; the 22 test files that read the default folders pass (913 tests), one withREADME.zh-CN.mdadded to the recall folder's file list. The last commit adds the workflow folder files to the leaks check;review-branch.test.tspasses (111), with type check and lint at exit 0.At
fbff2d0d1, the head, after the third round of review and mergingmain(#1802): type check,npm run lintandnpm run buildexit 0. The full unit suite (783 files, 23431 tests) has 23395 passed, 27 skipped, and the same 9 parallel-only OpenCode doctor failures; that file alone passes 80 of 80. Each fix of this round has a test that failed before it. The 30 Mermaid diagrams of the default READMEs render.At
f2742b72c, the head, after the fourth round of review: type check,npm run lintandnpm run buildexit 0. The full unit suite (783 files, 23434 tests) has 23398 passed, 27 skipped, and the same 9 parallel-only OpenCode doctor failures; that file alone passes 80 of 80.npm run test:e2eonpull-skipped-folders-1791,git-exclude-uninstall-915,hook-folder-worktreesandmanaged-resources-uninstall: 24 passed. The tests for the worktree and retention fixes fail on the commit before each one. The two-worktree record follows the team-policy record below.At
db8c1e302, the head, after the fifth round of review: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed sincef2742b72c(vitest-affected, 372 files, 11748 tests) pass but for the same 9 parallel-only OpenCode doctor failures (80 of 80 alone) and one test whosemcp-reconcilemock lacked an export pull reads: pull's MCP step had thrown there all along, unseen until14ba3f04dprinted it, and the mock is fixed indb8c1e302. Each fix of this round has a test that failed before it. The Linux-only case test of19165a0feis skipped on macOS and runs in CI.At
10e10703c, after the sixth round of review: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed sincedb8c1e302(vitest-affected, 339 files, 10744 tests) pass but for the same 9 parallel-only OpenCode doctor failures (80 of 80 alone). Each fix has a test that failed before it.At
02f0ad66d, after the seventh round of review: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed since10e10703c(vitest-affected, 8923 tests) pass but for the same 9 parallel-only OpenCode doctor failures (80 of 80 alone).npm run test:e2e -- src/__tests__/e2e/hook-folder-worktrees.test.ts: 3 passed. Each fix has a test that failed before it. Records from beforea042b9a8dshow a hook folder athooks/<id>/; it ishooks/<id>.<version>/since.At
c8cdfafc6, after the eighth round of review: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed since02f0ad66d(vitest-affected, 372 files, 11762 tests) pass but for the same 9 parallel-only OpenCode doctor failures (80 of 80 alone) and onemcp-reconciletest that pinned the unversionedmcp/notes/path, fixed in64fc4ac3b(305 of 305).npm run test:e2eonhook-folder-worktrees,git-exclude-uninstall-915,managed-resources-uninstallandmcp-uninstall: 21 passed. Each fix has a test that failed before it. Every version a test pins was computed outside teamai. Records from before64fc4ac3bshow an MCP folder atmcp/<name>/and a hook version taken from its command alone.At
4ad6f49c7, after the ninth round of review: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed sincec8cdfafc6(vitest-affected, 372 files, 11765 tests) pass but for the same 9 parallel-only OpenCode doctor failures (80 of 80 alone) and one Muse history test, which caught a change to which hash the history match checks; that change is reverted in7e21f8ec2(368 of 368 acrossmuse,mcp-reconcileandmcp-folders-delivery).npm run test:e2eonhook-folder-worktrees,mcp-uninstall,managed-resources-uninstallandrepo-attribution-worktrees-809: 13 passed. The last one failed in CI shard 1 atc8cdfafc6on the last of its seven sessions; it passes here and touches no folder code. Expected versions in tests come fromhelpers/folder-version.ts, which works them out from the team repo's folder on disk, and Python gives the same values. Records from before7e21f8ec2show a version taken fromHOOK.yamlorMCP.yamlalone.At
a2fc686f5, after the tenth round of review: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed since4ad6f49c7(vitest-affected, 372 files, 11767 tests) pass but for the same 9 parallel-only OpenCode doctor failures (80 of 80 alone).npm run test:e2eonhook-folder-worktrees,mcp-uninstallandmanaged-resources-uninstall: 7 passed.helpers/folder-version.tsnow reads text with CRLF as LF and leaves out the executable bit, as pull does.At
80b45408f, after the eleventh round of review: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed sincea2fc686f5(vitest-affected, 782 files with theorigin/mainmerge, 23467 tests) pass but for the same 9 parallel-only OpenCode doctor failures.npm run test:e2eonhook-folder-worktrees,mcp-uninstallandmanaged-resources-uninstall: 7 passed.helpers/folder-version.tsworks versions out withgit ls-files -s,-m,-oandgit hash-object --no-filters, not the code under test.At
41811c09c, after the twelfth round of review: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed since80b45408f(vitest-affected, 372 files, 11777 tests) pass but for the same 9 parallel-only OpenCode doctor failures.npm run test:e2eonhook-folder-worktrees,mcp-uninstallandmanaged-resources-uninstall: 7 passed.At
41b137727: type check andnpm run lintexit 0. The unit tests that reach what changed since41811c09c(vitest-affected, 372 files, 11778 tests) pass but for the same 9 parallel-only OpenCode doctor failures.At
1104e40eb: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed since41b137727(vitest-affected, 372 files, 11780 tests) pass but for the same 9 parallel-only OpenCode doctor failures.npm run test:e2eonhook-folder-worktrees,mcp-uninstallandmanaged-resources-uninstall: 7 passed.At
f57b27af9, the head: type check,npm run lintandnpm run buildexit 0. The unit tests that reach what changed since1104e40eb(vitest-affected, 287 files, 8934 tests) pass but for the same 9 parallel-only OpenCode doctor failures. No E2E file coversreview --branch; the real-CLI record above does.repo-attribution-worktrees-809failed CI shard 1 atc8cdfafc6andf57b27af9, both times missing the last session's event. Each hook hands its event to a detached child, and the test readevents.jsonlbefore the last child wrote.70ccbab3amakes it wait for those children (waitForDetachedChildren), a test-only change; it passes locally (6 of 6).Golden tests written before each move check that teamai's own texts did not change. They cover the three default workflows' prompts, 78 hint strings for
languageunset,enandzh(only the 16 zh friction texts change, on purpose), and the recall rule and blocks byte for byte.Each record below ran the built CLI in a sandboxed
HOME, against a bare team repo reached through a gitinsteadOfrewrite (gitprovider).Workflow folder,
teamai workflow start --driver local, ate20d4ecca. The folder holdsWORKFLOW.yaml, an executableplan.sh,summary.md(theprompt_file),notes.mdandREADME.md. The prompt step was answered by a stubclaude, which loggedTEAMAI_WORKFLOW_DIRand readnotes.mdfrom it.Hook folder, fired by Claude Code 2.1.319, at
4feacd514(user scope, this build first onPATHasteamai):Other real-CLI runs, one per type, each at the branch head named:
d515aa4f1teamai import --from-mr --dry-runsent the shippeddraft.en.mdtext. After the docs' copy-and-edit steps, the prompt held the team's added## Open questionssection (stubclaude)e61bcb5cdproblem.mdat Stop after 3 tool calls, underwith: { min_tools: 2, min_score: 1 }. Amin_tools: 5000push gave the refusal line above, and the delivered copy was removed829f87750checklist.mdthrough${TEAMAI_RULE_DIR}with no permission prompt. A control run without user settings was denied.teamai uninstall --forceremoved the grant74b64aa72teamai benchmark tryon aSUITE.yamltask passed.teamai statuscountedbenchmarks: 1b55a5d2d4jira-lite(a node.mjsand auv run --scriptPEP 723 server).claude mcp listshowed both✔ Connectedade867c4dteamai review --branchfailed the http-folder,${TEAMAI_MCP_DIR}, duplicate and missing-commandbranches with the messages above.teamai remove mcp jira-lite --forcecommitted the folder's removala60fbefbc.teamai/delivered/rules/api-style/under its own.git/info/excludeblock.teamai uninstall --forceremoved bothEvery type in one team repo, at
9bdf7677a. A member of projectcheckout(namespacepaymentsactive, Claude Code and Codex) that raninitand a firstpullon an earlier head pulls again with this build, then runsreview --branchon a branch that addsworkflows/teamai-release/andhooks/teamai-lint/. Each warning below comes from a broken definition the repo holds on purpose:A folder that is a symlink, at
4c36235cf. The same member reviews a branch whoseworkflows/shipandhooks/lintlink to directories undershared/in the team repo. The 17infolines are left out:The 17 info lines, one per root resource, are cut. None of them describes
hooks/teamai-lintorworkflows/teamai-release/as delivered any more; atfaafa77a5there were 19, those two included. The other fixes aftera60fbefbcare covered by unit tests: delivering a type's folders all or none, a case-only rename, uninstall across worktrees, a workflow folder file committed with CRLF, and a recall replacement holding a link or${TEAMAI_RULE_DIR}.Team policy on the Resources page, at
c97cbaa3d. The fixture team above, withmcp/jira-lite/turned into a stdionodeserver, and:GET /api/resources/layeredfromteamai dashboardfor that workspace, root andpaymentsdefinitions:Before this commit the three refused rows showed
in-force.githubstaysin-force: pull skips it on this machine for a variable it has not set, which the page does not judge (see Limitations).Two worktrees of one workspace, at
f2742b72c. The fixture team above withmcp/jira-lite/as a stdionodeserver,<checkout>and a linked worktree<wt2>, both pulled. The team then renamesserver.jstomain.jsand adds a line torules/api-style/checklist.md, and only<checkout>pulls:Once
<wt2>pulls, its.mcp.jsonstarts<wt2>/.teamai/delivered/mcp/jira-lite/main.js(jira v2), andserver.jsstays beside it until the folder goes.git status --untracked-files=alllists nothing under.teamaiin either worktree. Hooks stay shared: the hook entry in<checkout>/.claude/settings.local.jsonrunsbash "<data home>/hooks/block-secrets/scan.sh", as every worktree runs the same hook entries.A configuration pull cannot write, at
14ba3f04d. The same<checkout>, with the team'sjira-liteinstalled and printingjira v2. The team changesmain.jsto printjira v3and adds"--v3"toargs; the member's checkout directory is read-only, so.mcp.jsoncannot be replaced:Before
14ba3f04dthat pull printed nothing about MCP. Beforea6e324284the old.mcp.jsonstarted the newmain.js(jira v3). With the team droppingjira-liteinstead, the read-only pull keeps both the entry and the folder, and the next pull removes them together (c674de897).Removing a rule folder, at
10e10703c. The same<checkout>, withrules/api-style/delivered:<checkout>/.claude/rules/api-style.mdand<checkout>/.teamai/delivered/rules/api-style/are gone. Before10e10703cthe folder stayed in the team repo, and the refresh that follows the removal delivered it again.A hook entry pull cannot rewrite, at
02f0ad66d. Workspace with a team repo; Claude Code's entries in the main checkout's.claude/settings.local.json. The installed entry runsblock-secrets.5508e78f/scan.sh --v2. The team then changes the script and its command to--v3, and the member'ssettings.local.jsonis read-only:runsis the whole installed command run through bash, as Claude Code runs it. The same run on the build before the fix prunedblock-secrets.2030ec53while the entry still named it: the main checkout's manifest sits in<data home>/workspaces/<id>/, which the prune did not read.An MCP file pull cannot rewrite, at
c8cdfafc6,4ad6f49c7,54f026449and80b45408f. A team MCP server folder whose MCP file pull cannot rewrite (jira-lite,node "${TEAMAI_MCP_DIR}/main.js" --v3, Claude Code and Codex):3dc59bcbis the first 8 hex digits of the SHA-256 of{"args":["${TEAMAI_MCP_DIR}/main.js","--v3"],"command":"node","name":"jira-lite","transport":"stdio"}, computed outside teamai.The version now comes from the folder's files. The first pull on that build moved the server to
jira-lite.b61b2284/(same files, new formula). The team then changes onlymain.js, withMCP.yamlunchanged:At
54f026449the version reads text with CRLF as LF, and leaves out the executable bit and the files git ignores. The first pull on that build moved the server tojira-lite.f87ad19c/. A member whose team clone is a Windows-style checkout then pulls the same commit. That clone hascore.autocrlf=trueandcore.fileMode=false, an executableserver.py, and an ignored__pycache__/:Both pulls give
f87ad19c. A Python script outside teamai gives the same value from the filesgit ls-fileslists atHEAD, with CRLF read as LF.At
80b45408fa committed file counts by its mode and git blob id. The team addsstart.bat, saved in GBK, which is not UTF-8. One member's clone pulls it laid out the Windows way, then the same clone laid out the macOS way:A Python script outside teamai gives
edef9a43fromgit ls-files -sof the team repo.At
41811c09ca folder that holds a git submodule is refused. The team vendors a server as a submodule,mcp/vendored/server, which the member's team clone has not checked out. The build before it deliveredvendoredwith onlyMCP.yaml:A rule folder whose directory becomes a file, at
41b137727.rules/review-list/holdsdetails/checklist.md; the team replacesdetails/with a filedetails. A rule copy the member edited, which pull keeps, may still name the checklist, so pull says it went:A repository of its own under an ignored directory, at
1104e40eb. The team clone ignoresbuild/, andmcp/jira-lite/build/vend/is a clone of its own. Git lists it as one ignored record, and pull delivers the same version without it. Before the fix, the unit test for this case got the folder refused:teamai review --branchon default hook and recall replacements, atf57b27af9. A branch copies teamai'shooks/teamai-friction-reminder/withmin_tools: 5000, and a validrules/teamai-recall/whoseblock.mdholds an API key. Before the fix, the unit tests for both cases got no finding:Dashboard
The Resources page of the fixture member above, built at
9bdf7677a, in headless Chromium. No page has a horizontal scrollbar at any width (scrollWidth - clientWidthis 0 on all six).zh-CN, darkRelated Issues
Closes #1787
Notes for Reviewers
Breaking or behaviour changes
Compared with the last release, a team or member notices:
WORKFLOW.yaml,HOOK.yaml,RULE.md,MCP.yaml,SUITE.yaml) is one resource, and every file in it belongs to it.rules/onboarding/RULE.mdwas the ruleonboarding/RULE, and each other.mdthere was a rule of its own. Nowrules/onboarding/is the rule folderonboarding, and pull removes the copies of the other files and says so once.workflows/release/WORKFLOW.yamlwas a workflow namedWORKFLOW; it is now the workflow folderrelease. ASCORER.mdorAGENT.mddirectory is skippedgit mv rules/onboarding/RULE.md rules/onboarding/overview.mdteamai-*workflow, hook or MCP folder only replaces a default of that name. Any other is skipped with a warning. A single fileworkflows/teamai-x.yamlkeeps workingteamai-import-from-mr,teamai-codebase-deep-enrichandteamai-import-from-repoship as folders, notworkflows/<name>.yamlcp -R "$(npm root -g)/teamai-cli/workflows/teamai-import-from-mr" workflows/. A teamworkflows/<name>.yamlstill replaces the defaultlanguage: zh, the friction reminder is in Chinese. Every other hint prints what it printed beforelanguage: zhteamslanguage, so a brokenteamai.yamlmakes them printInvalid teamai.yaml: ..., as the TodoWrite and MR hints already didteamai.yamlTEAMAI_WORKFLOW_DIR,TEAMAI_HOOK_DIR,TEAMAI_RULE_DIRandTEAMAI_MCP_DIRare reserved team env names, and a team value for them is ignored with the warning above. The CHANGELOG lists it under Breaking Changes~/.teamai/rulestopermissions.additionalDirectoriesin~/.claude/settings.json, after the member's own entries. A project needs no grant: its folders are in the worktree.teamai/delivered/rules/and.teamai/delivered/mcp/; a single-repo worktree also gets.teamai/delivered/hooks/. Git ignores it through its own.git/info/excludeblock, whateversharing.gitExcludesaysteamai doctor --fix, removes the team hook entries it left in HOMEbenchmarks/<suite>/SUITE.yamlis accepted, and docs and messages saySUITE.yaml. A directory holding both spellings is invalidrequireTeamScriptsalso keeps a folder hook whose command names${TEAMAI_HOOK_DIR}hooks/andrules/Members on an older teamai misread folders. Before #1791 they read each file of
rules/api-style/as its own always-on rule, and from #1791 on they skip the folder. Every member should upgrade before the team commits a folder; each type's docs section says so.Limitations / not verified
windowsjob's list (default-hooks,delivered-folders,hook-folders,mcp-folders,rule-folder-paths,workflow-folder-paths), plus new cases ine2e/hook-shells-windows.test.ts. None ran locally; theWindows (paths, hook rendering, hook shells)job passed at9bdf7677a.hook-folders-dispatch.test.tssimulates win32 for CodeBuddy on macOS and is not on that list.gitprovider ran;gitlabandgithubare left to CI.hooks/teamai-friction-reminder/*.zh.mdtexts and the zh-CN guide pages need a reviewer who reads Chinese.teamai doctor --fix, once no run and no pulled workflow uses it and it is an hour old, or once a run was swept pastworkflows.retention. A folder used by a run that is still kept stays.sharing.mcp.allowedCommands,allowedHosts,sharing.hooks.requireTeamScripts). It does not judge what one machine lacks: a variable or secret not set, a missingrequiresbinary, or a transport a tool cannot run. Pull names those per tool.sharing.*.autoApplyandTEAMAI_HOOKS_DISABLEDhold hooks untilteamai hooks inject, and the page shows them in force.~/.claude.json([feat] keep the resources pull delivers in project scope out of git #915), Claude Code files every worktree of a repository under one key (claudeProjectKey). That entry names the folder of the worktree that pulled last, which keeps working while that worktree exists. Once it is removed, Claude Code in the others cannot start the server until their next pull.private: true(workflows/teamai-import-from-mr/WORKFLOW.yaml,workflows/teamai-codebase-deep-enrich/WORKFLOW.yamlandworkflows/teamai-import-from-repo/WORKFLOW.yaml, line 5).workflow publishrefuses a private run withisolated_run, so no such run reaches a claim. The version-mismatch refusal is shared with single-file defaults and tested there.Commits
145 commits, grouped by slice. The branch also has merge commits from integrating the slices and
origin/main.Slice 0. One layered resolver (3)
Slice 1. Workflow folders (8)
Slice 2. Three default workflows as folders (5)
Slice 3. Hook folders, and delivery to the data home (15)
Slice 4. Default hook folders (5)
Slice 5. Rule folders (9)
Slice 6. SUITE.yaml (3)
Slice 7. MCP server folders (6)
Across types: markers, docs, CHANGELOG (7)
Dashboard (8)
Review fixes (76)