docs: replace templates/ with library/, drop unaudited Product section

team-guide is now positioned as the external rulebook agents read at
project start: project AGENTS.md files reference team-guide rather
than duplicating its content.

- Delete templates/ (5 files). The only useful one — AGENTS.md
  skeleton — is now an inline code block in AGENTS.md §2. Handoff
  checklist also inlined into AGENTS.md §7.
- Remove the unaudited "Product projects" section (was AGENTS.md §5).
  Project repos document their own release scheme in their own
  AGENTS.md.
- Add library/ as a catalog for narrower specs.
- Seed library/git-upload/SPEC.md: what to commit / what not to,
  .gitignore baseline, sensitive-info scan, leaked-secret recovery.
- AGENTS.md gets a "How AI agents use this repo" intro and a §5 Team
  library section indexing library/.
- README.md updated to match: explicit "for AI" framing, library
  section, drop product-spec mentions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
阿白叔andClaude Opus 4.7 committed 2026-05-20 23:38:46 +08:00
1 parent 94eb7ef70a
commit c5e6ebb534
9 files changed
+514 -637

No files matched your search

+135 -302
View File
@@ -9,6 +9,21 @@ truth.
> Human-facing entry point: [`README.md`](README.md) (Chinese,
> condensed). When humans want the full ruleset, they read this file.
## How AI agents use this repo
Before starting non-trivial work in any team project, an agent should:
1. **Read this `AGENTS.md`** — general rules (vibe coding, Git, code
style, planning, handoff).
2. **Scan [`library/README.md`](library/README.md)** — focused specs
for narrower topics. Read the entries that match the current task.
3. **Read the project's own `AGENTS.md`** — project-specific stuff
(how to run it, architecture, project-only don'ts). Project AGENTS.md
files do **not** repeat team-guide content; they reference it.
In short: team-guide is the external rulebook every project's agent
reads at task start. Project AGENTS.md files stay small and specific.
## Project
This repo holds our team's working agreements. It is **documentation,
@@ -27,12 +42,9 @@ read the change and would have written the same."
## Language policy
- **Human-facing**: Chinese — `README.md` and the human-fillable
templates (`templates/README.md.template`,
`templates/PR_DESCRIPTION.template.md`,
`templates/HANDOFF_CHECKLIST.template.md`).
- **AI-facing**: English — this file, `CLAUDE.md`,
`templates/CLAUDE.md.template`, `templates/AGENTS.md.template`.
- **Human-facing**: Chinese — `README.md` only.
- **AI-facing**: English — this file, `CLAUDE.md`, anything under
`library/`.
- **Git metadata**: English — commit messages, PR titles, branch
names, tag annotations. AI tools and search work better on English.
@@ -172,7 +184,42 @@ In this order:
A new contributor (human or AI) should be productive after one read.
Past 100 lines, split — it's drifted into "documentation."
Use [`templates/AGENTS.md.template`](templates/AGENTS.md.template).
Skeleton to copy into a new project's `AGENTS.md`:
```markdown
# AGENTS.md — <project name>
> Reference: team-guide (https://git.simgreek.com/simgreek/team-guide)
> for cross-project rules. This file holds only what's specific to
> this project.
## Project
<one or two sentences>
## Run it
```bash
<install / run / test / lint commands>
```
## Architecture
<one paragraph: entry points, data flow, major modules>
Key files:
- `<path>` — <one-line role>
## Conventions specific to this repo
<naming patterns, where to add new features, what's auto-generated>
## Don'ts
- Don't <…>
```
`CLAUDE.md` in a new project is one line: `@AGENTS.md`.
### Permissions (Claude Code)
@@ -355,8 +402,11 @@ task_assistant: drop unused legacy export path
- One PR per topic. Can't describe in one sentence → multiple PRs.
- Title under 70 chars, same shape as commit summary.
- Description uses
[`templates/PR_DESCRIPTION.template.md`](templates/PR_DESCRIPTION.template.md).
- Description structure: **Summary** (1 sentence + bullets if needed) /
**Why** / **What changed** (bulleted by file or area) / **Test plan**
(checkbox list, honest) / **Out of scope** (optional) / **Notes for
reviewer** (optional, for surprising AI decisions). Add a
`🤖 AI-assisted` trailer for AI-assisted PRs.
- First push of a feature branch uses `-u`.
- Open as draft once runnable. Review-as-you-go beats review-at-the-end.
@@ -388,30 +438,18 @@ Author follow-ups:
### Tagging
Two styles by project type:
Tags are dated: `YYYYMMDD`, with `-N` suffix for same-day reissues
(`20260520-2`). Tag from `main`.
| Project type | Tag format | Example | Tag from |
| ------------ | ------------------ | ------------------------ | -------- |
| Spec repo | `YYYYMMDD[-N]` | `20260520`, `20260520-2` | `main` |
| Product repo | `vX.Y.Z` | `v0.2.4` | `dev` |
Decide: would a "user" receive a versioned artifact from this project?
Yes → product. No → spec.
Universal:
Rules:
- Annotated only (`git tag -a`).
- Tag message summarizes what changed since the previous tag.
- Tags are immutable once pushed. Wrong tag → cut a new one.
- Don't tag on feature branches.
- Max one tag per day, use `-N` for same-day reissues.
Spec-repo specific: max one tag per day. Same-day reissues → `-N`
suffix.
Product-repo specific: see [Product project rules](#5-product-projects)
for the full ruleset (semver triplet, manifest, sync list).
Spec tag:
Cut a tag:
```bash
git checkout main && git pull --ff-only
@@ -419,14 +457,6 @@ git tag -a 20260520 -m "team-guide 20260520: bilingual policy"
git push origin 20260520
```
Product tag:
```bash
git checkout dev && git pull --ff-only <remote> dev
git tag -a v0.2.4 HEAD -m "<Project> V0.2.4"
git push <remote> v0.2.4
```
Inspect:
```bash
@@ -435,19 +465,20 @@ git show 20260520
git log --oneline 20260513..20260520
```
When to cut a spec-repo tag:
When to cut a tag:
- Docs changed in a way teammates need to re-read.
- A template was added, removed, or restructured.
- A new convention is now in effect (not just proposed).
- A library/ entry was added, removed, or restructured.
When **not** to cut a spec-repo tag:
When **not** to cut a tag:
- Typos, formatting, link fixes → just push to `main`.
- Drafts under discussion → use a PR.
Product tagging follows the release flow in
[Product projects](#5-product-projects).
Project repos in the workspace use their own tag schemes (typically
semver `vX.Y.Z`). Each project documents its own scheme in its own
`AGENTS.md`.
### Don'ts
@@ -537,8 +568,7 @@ Every repo has one. In order:
4. **Where does data come from / go to?** Only if non-obvious.
5. **Pointers.** Related repos, dashboards, docs.
Use [`templates/README.md.template`](templates/README.md.template).
Shorter than the template is fine — delete unused sections.
Shorter than this is fine — drop sections that don't apply.
### Don'ts
@@ -549,269 +579,22 @@ Shorter than the template is fine — delete unused sections.
---
## 5. Product projects
## 5. Team library
For projects that ship versioned artifacts to users (task_assistant,
authoring-tool, etc.). Spec repos (this one) ignore this section.
Narrower specs that don't fit cleanly in this file live under
[`library/`](library/). Catalog: [`library/README.md`](library/README.md).
### Spec vs product
When an agent picks up a task, it should scan the catalog after reading
this file and read entries that match. Each entry leads with a "When
to read this" section so the decision is fast.
| Dimension | Spec repo | Product repo |
| ------------------ | ---------------------------- | ------------------------------------- |
| Content | Docs, conventions, templates | Executable code, shippable artifacts |
| Tag format | `YYYYMMDD` / `YYYYMMDD-N` | `vX.Y.Z` |
| Acceptance | Human can read it | Tests pass, runs |
| Distribution | Git itself | Git (source) + dist channel (binaries)|
| Version-field sync | None | Multiple sites must agree |
| Users | Team members | Real end users |
Current entries:
Unsure? "Will a user receive a versioned artifact from this?" Yes → product.
- [`library/git-upload/`](library/git-upload/SPEC.md) — what to commit,
what not to, how to recover from leaked secrets.
### Versioning
Semver triplet: `major.minor.patch`.
- **major** — backward-incompatible (schema, CLI args, artifact format)
- **minor** — backward-compatible additions
- **patch** — bug fixes, perf, internal refactors
Three forms, **all must agree**:
| Use | Format | Example | Where |
| ----------- | --------- | --------- | ----------------------------------- |
| Internal | `X.Y.Z` | `0.2.4` | `package.json`, `pyproject.toml` |
| Display | `VX.Y.Z` | `V0.2.4` | UI chips, README title, release note|
| Git tag | `vX.Y.Z` | `v0.2.4` | Git tag |
Each product project lists its **release-bump checklist** in one place
(usually its own `AGENTS.md`). task_assistant's example:
```
package.json "version": "0.2.4"
public/index.html version chip default
server.js fallback version
scripts/build-release.js fallback + release notes
scripts/build-release-windows.js fallback + release notes
README.md title, version status
README.en.md same
```
Miss one → next release drifts.
### Tags (product)
- Annotated. Message: `<Project Name> V<x.y.z>`.
- One version, one tag — don't split across platforms.
- Already-shipped tags don't move. Wrong → ship a patch.
- Mistake before shipping (rare):
```bash
git tag -d v0.2.4
git push <remote> :refs/tags/v0.2.4
git tag -a v0.2.4 <correct-sha> -m "<Project> V0.2.4"
git push <remote> v0.2.4
```
### Branches
`dev` is the collaboration trunk. Feature branches off `dev`, PR back to
`dev`. Don't keep an unclear `master`. Stable branches use clear names:
`release/v0.3`, `release/v0.3-hotfix`.
### Git vs distribution channel
Git holds source. The distribution channel (OpenList, Hugging Face,
S3, etc.) holds artifacts. They don't mix.
Into Git:
- Source, build scripts, docs, conventions, small static assets,
templates, role/config tables.
Out of Git:
```
config/ local config
logs/ runtime logs
feedback-records/ user feedback
generated_task_packages/ task outputs
reports/ verification reports
runtime-temp/ transient state
release/ release-build/ release-dev/ release-merge/
.venv/ __pycache__/ node_modules/
```
Distribution channel layout (typical):
```
/<project>/dist/ release zips + manifest
/<project>/feedback/<machine-id>/ uploaded user feedback
```
Release zips are **self-contained**: user unzips, clicks, runs. No
dependency installs on user machines.
### Manifest
Top-level `manifest.json` in the dist channel — clients read it to
decide whether to update:
```json
{
"name": "<project-name>",
"version": "0.2.4",
"displayVersion": "V0.2.4",
"released_at": "2026-05-18T17:00:00Z",
"platforms": {
"windows": {
"url": "<dist-url>/<project>-v0.2.4-windows.zip",
"size": 123456789,
"sha256": "<hex>"
},
"macos-arm64": { "url": "...", "size": ..., "sha256": "..." },
"macos-x64": { "url": "...", "size": ..., "sha256": "..." }
},
"release_notes": "<short markdown>"
}
```
After upload, **re-fetch** the manifest and eyeball size + sha256.
Same size as previous → cache or upload error.
### Update flow (user-confirmed, not silent)
1. Client startup fetches manifest, compares versions.
2. New version → **prompt the user**, don't auto-download.
3. User confirms → download to local.
4. User confirms install → restart.
Never silently skip a step. This goes in every product's `AGENTS.md`
"Don'ts."
### Feedback & logs
Local-first, async upload:
```
local:
feedback-records/feedback-<timestamp>-<id>.json
logs/<project>-YYYY-MM-DD.jsonl
remote (after successful upload):
/<project>/feedback/<machine-id>/<feedback-file>.json
```
- Upload failure must not lose local data. UI says "saved locally,
upload failed, retry later."
- **Redact before send**: API keys, Bearer tokens, cookies, passwords,
secrets, private account info.
- Triage flow: ask users to use the feedback page, **not** to send raw
`config/` or full log directories.
### Sensitive-info scan
Pre-commit:
```bash
git diff --cached
```
Periodic keyword scan:
```bash
git grep -nE "sk-|hf_|Bearer |apiKey|ANTHROPIC_API_KEY|OPENAI_API_KEY|password|secret" \
-- ':!*.lock' ':!vendor/**' ':!**/__pycache__/**'
```
Hits require **human judgment** — demo keys in comments and real keys
both match. Don't blind-commit, don't blind-delete.
If a real secret was committed:
1. Invalidate the key/token immediately.
2. Replace local config.
3. Notify collaborators.
4. Decide whether to rewrite Git history (`git filter-repo` or team-agreed
tool).
A "delete the key" commit alone is **not safe** — history still has it.
### Standard release flow
```bash
# 1. Sync
git checkout dev
git pull --ff-only <remote> dev
git status --short --branch
# 2. Check
<lint command>
<test command>
# 3. Bump version (every site on the project's bump checklist)
# 4. Commit + tag
git add <files>
git commit -m "chore: release vX.Y.Z"
git tag -a vX.Y.Z HEAD -m "<Project> VX.Y.Z"
git push <remote> dev
git push <remote> vX.Y.Z
# 5. Build
<build command>
# 6. Upload manifest + zips, verify size/sha256
```
### Product README required sections
On top of the standard README sections, product projects add:
- **Version status** — current source version, internal version,
collaboration branch, repo URL, migration source (if any), default
local service URL (if any), default output dir.
- **Quick start** — per platform (Windows / macOS / Linux): unpack,
start, access, stop.
- **Bundle contents** — what's inside the release zip.
- **Release-bump checklist** — which files contain version strings to
update on release.
### Minimum delivery checklist
Every "ready to ship" version must have:
- [ ] `<remote>/dev` has the corresponding commit
- [ ] `<remote>` has the corresponding tag (`v<x.y.z>`)
- [ ] `package.json` / `pyproject.toml` version correct
- [ ] UI version chip displays correctly
- [ ] Lint / typecheck / test all pass
- [ ] Distribution channel manifest points at correct platform zips
- [ ] manifest size / sha256 match actual files
- [ ] Release zip unpacks → start script → runs
- [ ] Zip contains **no** API keys, logs, user feedback, generated
outputs, or verification reports
Any unchecked → not "ready to ship."
### What new product projects need
Beyond the standard `AGENTS.md` + `CLAUDE.md` + `.claude/`:
1. **`docs/COLLABORATION_AND_RELEASE_WORKFLOW.md`** (or similar) — a
project-specific specialization referencing this section, listing
the project's bump checklist, build commands, and dist paths.
task_assistant's is the reference example.
2. **`scripts/build-release.*`** — outputs zip + updates `manifest.json`.
3. **Bump checklist** — single source of truth in `AGENTS.md` or the
workflow doc above.
4. **`CHANGELOG.md`** — one entry per version, semver order, user-visible
changes.
YAGNI:
- Complex release tooling (Lerna, Changesets) — small team, manual is fine.
- Auto-generated release notes — good commit messages suffice.
- Multi-environment config systems — only when actually needed.
Promotion criteria, layout, and adding rules: see
[`library/README.md`](library/README.md).
---
@@ -876,9 +659,8 @@ Handoff is **part of the deliverable**, not afterthought packaging.
- **External** — versioned artifact to a partner / customer / downstream.
Zip, dataset, release.
Both use
[`templates/HANDOFF_CHECKLIST.template.md`](templates/HANDOFF_CHECKLIST.template.md).
External has higher bar.
Both use the [handoff checklist](#handoff-checklist) below. External has
higher bar.
### Task package layout
@@ -952,6 +734,57 @@ description → run test plan → form an opinion — **without messaging you.**
3. Note any surprise — naming, missing files, version mismatch — and
send back within a day. Drift gets worse with silence.
### Handoff checklist
Copy into the package (external handoff) or PR description (internal).
Fill it before declaring handoff done.
```markdown
## Identity
- Name:
- Version: <e.g. v0.5.0 or commit sha or tag>
- Generated at: <ISO timestamp>
- Source repo:
- Source commit: <full sha>
- Owner: <name>
- Recipient: <name or team>
## Contents
- [ ] README.md — what this is, how to use it
- [ ] CHANGELOG.md — diff vs previous version (or "first release")
- [ ] manifest.json — all fields filled or explicitly null
- [ ] VERIFICATION.md — what was checked, results
- [ ] Data / artifacts
- [ ] Scripts (only what's required to use the package)
## Verification
- [ ] Record / file counts match expected
- [ ] Checksums computed and recorded
- [ ] Sanity checks pass (list them)
- [ ] No secrets, .env, or credentials
- [ ] No PII unless explicitly part of deliverable
- [ ] Total size reasonable for delivery channel
## Reproducibility (external handoff only)
- [ ] Confirmed someone with repo access can rebuild from source_commit
- [ ] Build / generation command documented in README.md
- [ ] External dependencies pinned
## Provenance (if AI-assisted)
- Model used:
- Human-in-loop steps:
- Notable AI-assisted decisions:
## Known limitations
- <…>
## Recipient instructions
- [ ] Read README.md first
- [ ] Run verification report; if fails, stop and contact sender
- [ ] Confirm receipt within <X days>
- [ ] Report any surprises within <X days>
```
---
## Working directory expectations (this repo)