agentleFS
echoVicechoVic/blade-code/AGENTS.md

blade-code

AGENTS.md181 starsChanged 11 months agoMITView on GitHub

Always respond in Chinese. Blade Code is a modern AI-powered coding assistant with CLI + Web UI, built with React + Ink (CLI) and React + Vite (Web), using TypeScript. - packages/cli/package.json is the only authoritative npm version. The root package.json version is private monorepo metadata. - Release each independent feature or fix as its own npm patch version. - Keep implementation, release metadata, and any qualification fix in separate commits so the exact candidate is auditable. - Serialize releases.…

  • Deletes or force-pushes
  • Installs packages
  • Commits and pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

17 rules. About 0 are common, 7 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Always respond in Chinese.

    line 3
  2. Distinctive:

    Use TypeBox schemas for tool parameters (not Zod)

    line 72
  3. Distinctive:

    Keep implementation, release metadata, and any qualification fix in separate commits so the exact candidate is auditable.

    line 88
  4. Very specific:

    Start from a clean main synchronized with origin/main.

    line 96
  5. Distinctive:

    Commit the implementation or fix before preparing release metadata.

    line 97
  6. Distinctive:

    Update both changelogs with the same version heading and equivalent content:

    line 99
  7. Very specific:

    Update related bilingual user documentation when behavior is user-facing.

    line 103
  8. Very specific:

    Do not edit generated docs/changelog.md or docs/en/changelog.md.

    line 104
  9. Very specific:

    Commit release metadata as chore: release v<version>.

    line 105
  10. Very specific:

    Do not add a separate npm dist-tag add step unless the npm Trusted Publisher is explicitly configured with Allow npm dist-tag.

    line 146
  11. Distinctive:

    Do not use legacy long-lived npm tokens or the old token helper scripts.

    line 150
  12. Very specific:

    If npm publish succeeds but a later step fails:

    line 164
  13. Distinctive:

    Do not rewrite the public tag or attempt to republish the immutable npm version.

    line 166
  14. Very specific:

    Verify npm view blade-code@<version> version and the latest dist-tag.

    line 168
  15. Very specific:

    Create only the missing GitHub Release from the matching CHANGELOG.md section with gh release create ...

    line 169
  16. Very specific:

    If CI exposes a newly disclosed transitive vulnerability, update the smallest compatible dependency or lockfile entry, run bun audit …

    line 173
  17. Very specific:

    Verify the immutable version, latest, GitHub Release, remote tag, and clean worktree:

    line 179

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Always respond in Chinese.

Project Overview

Blade Code is a modern AI-powered coding assistant with CLI + Web UI, built with React + Ink (CLI) and React + Vite (Web), using TypeScript.

Quick Commands

# Development
bun run dev           # Start CLI dev mode (watch)
bun run dev:web       # Start CLI + Web server
bun run build         # Build CLI

# Running
blade                 # Start interactive CLI
blade web             # Start Web UI (opens browser)
blade serve           # Start headless server

# Testing & Quality
bun run test:all      # Run all tests
bun run lint          # Run linter
bun run type-check    # TypeScript type checking

Architecture

Monorepo Structure

Blade/
├── packages/
│   ├── cli/            # blade-code - CLI core (npm package)
│   │   └── src/
│   │       ├── agent/          # Stateless Agent core
│   │       ├── tools/          # Tool system (builtin, execution, registry)
│   │       ├── server/         # Web server (Hono)
│   │       ├── mcp/            # MCP protocol support
│   │       ├── context/        # Context management
│   │       ├── config/         # Configuration management
│   │       ├── ui/             # Terminal UI (React + Ink)
│   │       ├── store/          # State management (Zustand)
│   │       ├── services/       # Service layer (Chat, Session, etc.)
│   │       ├── services/pi/    # pi-ai runtime adapter
│   │       ├── schema/         # TypeBox runtime wrapper
│   │       ├── commands/       # CLI subcommands (serve, web, mcp, etc.)
│   │       ├── prompts/        # Prompt templates
│   │       ├── slash-commands/ # Slash commands
│   │       ├── skills/         # Skills system
│   │       ├── hooks/          # Hooks system
│   │       └── blade.tsx       # Entry point
│   └── vscode/         # blade-vscode - VSCode extension
├── docs/               # User documentation (Docsify)
└── .blade/             # Project-level config

Key Design Principles

  1. Stateless Agent: Agent doesn't store session state; all state passed via context
  2. Tool System: Unified tool registration, execution, and validation with TypeBox schemas
  3. Permission Control: Three-level permission system (allow/ask/deny)
  4. Session Management: Multi-session support with resume and fork capabilities
  5. pi-ai Runtime: Single LLM abstraction layer; model metadata from catalog, not hardcoded

Code Style

  • TypeScript strict mode
  • Biome for linting and formatting (single quotes, semicolons, 88 char line width)
  • Avoid any type
  • Use TypeBox schemas for tool parameters (not Zod)

Testing

  • Test framework: Vitest
  • Tests location: packages/cli/tests/
  • Run tests: bun run test:all
  • Integration tests must use real API calls, no mocks

Release Process

Release Boundaries

  • packages/cli/package.json is the only authoritative npm version. The root package.json version is private monorepo metadata.
  • Release each independent feature or fix as its own npm patch version.
  • Keep implementation, release metadata, and any qualification fix in separate commits so the exact candidate is auditable.
  • Serialize releases. Do not push multiple new release tags in one batch: npm assigns latest when each publish completes, so concurrent releases can leave latest pointing at an older version.

Prepare and Qualify the Exact Candidate

  1. Start from a clean main synchronized with origin/main.
  2. Commit the implementation or fix before preparing release metadata.
  3. Bump packages/cli/package.json.
  4. Update both changelogs with the same version heading and equivalent content:
    • CHANGELOG.md is the English authoritative source consumed by npm and VersionChecker.
    • CHANGELOG.zh.md is the manually synchronized Chinese source.
  5. Update related bilingual user documentation when behavior is user-facing. Do not edit generated docs/changelog.md or docs/en/changelog.md.
  6. Commit release metadata as chore: release v<version>.
  7. On that exact commit, run the pre-tag gate:

    scripts/verify-release-candidate.sh <version>

    The script codifies steps 7-8 of this checklist: it refuses a dirty worktree, requires matching headings in both changelogs, blocks reuse of a local or remote tag and of an existing npm version, and then runs bun install --frozen-lockfile, bun run build, bun run test:all, bun run lint, and bun run type-check. bun run lint includes the repository-wide Biome format check, so package-only lint commands are not an equivalent gate. Paid real-API qualification remains separate and must be run when the affected release matrix requires it.

  8. The script also re-checks that the worktree is clean after the gate; abort if any step fails before continuing to tag creation.
  9. Extract the exact English changelog section into a temporary notes file and create an annotated tag:

    git tag -a v<version> -F <release-notes-file>
    git cat-file -t v<version>       # must print: tag
    git rev-list -n 1 v<version>     # must equal the qualified candidate SHA
  10. Push the branch and one release tag:

    git push origin main
    git push origin v<version>

Automated Publication

  • .github/workflows/publish.yml runs the full reusable CI workflow before publishing.
  • The workflow validates that v<version> matches packages/cli/package.json, builds again, upgrades npm, publishes with Trusted Publishing (OIDC), and ensures a GitHub Release exists.
  • npm publishing must use npm publish --access public --tag latest.
  • Do not add a separate npm dist-tag add step unless the npm Trusted Publisher is explicitly configured with Allow npm dist-tag. Without that permission npm returns E403 after a successful publish and prevents later workflow steps, including GitHub Release creation.
  • Do not use legacy long-lived npm tokens or the old token helper scripts.
  • Publication is idempotent: an existing npm version is skipped and an existing GitHub Release is retained.

Monitor and Recover

Monitor the tag workflow until the publish job completes:

gh run list --workflow=publish.yml --limit=5
gh run view <run-id> --json status,conclusion,jobs
gh run view <run-id> --log-failed

If npm publish succeeds but a later step fails:

  1. Do not rewrite the public tag or attempt to republish the immutable npm version.
  2. Verify npm view blade-code@<version> version and the latest dist-tag.
  3. Create only the missing GitHub Release from the matching CHANGELOG.md section with gh release create ... --verify-tag.
  4. Fix the workflow in a separate patch release.

If CI exposes a newly disclosed transitive vulnerability, update the smallest compatible dependency or lockfile entry, run bun audit --audit-level=critical, and qualify that fix as its own patch release.

Post-Release Verification

  1. Verify the immutable version, latest, GitHub Release, remote tag, and clean worktree:

    npm view blade-code@<version> version
    npm view blade-code dist-tags.latest
    gh release view v<version>
    git ls-remote --tags origin refs/tags/v<version>
    git status --short --branch
  2. npm metadata can appear before the tarball CDN is ready. If installation returns tarball 404, wait and retry; do not publish the version again.
  3. Finish with a clean-directory installation smoke test:

    tmpdir="$(mktemp -d)"
    trap 'rm -rf "$tmpdir"' EXIT
    cd "$tmpdir"
    npm init -y >/dev/null 2>&1
    npm install --ignore-scripts blade-code@latest
    node -p "require('./node_modules/blade-code/package.json').version"
    ./node_modules/.bin/blade --version

    The installed package version, CLI-reported version, and npm latest dist-tag must all equal the released version.

The docs site (docs/) is bilingual: Chinese is the default under the docs root and English lives under docs/en/. docs/changelog.md (zh) and docs/en/changelog.md (en) are build artifacts synced from CHANGELOG.zh.md and CHANGELOG.md by the Deploy Docs workflow — do not edit them directly.

Documentation

  • User docs: docs/
  • README.md - Project overview
  • CONTRIBUTING.md - Contribution guide

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.