agentleFS
joshuadavidthomasjoshuadavidthomas/opencode-beads/AGENTS.md

opencode-beads

AGENTS.md266 starsChanged 2 months agoMITView on GitHub

Triggers: User says "bump the version", "cut a new release", "release a new version", "let's do a release", or similar. If the user specifies a version number (e.g., "bump to 0.4.0") or bump type (major/minor/patch), use that. Otherwise: Use this exact format: IMPORTANT: This project uses bd (beads) for ALL issue tracking. Do NOT use markdown TODOs, task lists, or other tracking methods. Check for ready work: Create new issues: Claim and update: Complete work:

  • Installs packages

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

21 rules. About 0 are common, 9 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use import type for type-only imports (verbatimModuleSyntax)

    line 10
  2. Very specific:

    If the user specifies a version number (e.g., "bump to 0.4.0") or bump type (major/minor/patch), use that.

    line 32
  3. Distinctive:

    Read the actual diffs: - don't rely solely on commit messages:

    line 37
  4. Very specific:

    package.json: - Update "version" field

    line 47
  5. Very specific:

    Add new version heading: ## [X.Y.Z]

    line 50
  6. Very specific:

    Update [unreleased] compare link at bottom to compare from new version

    line 51
  7. Distinctive:

    Add new version release link at the end of the reference links list

    line 52
  8. Distinctive:

    README.md: - Update version in the installation example JSON

    line 53
  9. Distinctive:

    Use this exact format:

    line 57
  10. Distinctive:

    Discover new work?: Create linked issue:

    line 127
  11. Very specific:

    Commit together: Always commit the .beads/issues.jsonl file together with the code changes so issue state stays in sync with code state

    line 130
  12. Distinctive:

    Test references (point to test files or test_data examples)

    line 144
  13. Distinctive:

    No manual export/import needed!

    line 180
  14. Very specific:

    If using GitHub Copilot, also create .github/copilot-instructions.md for automatic instruction loading.

    line 184
  15. Very specific:

    Run bd onboard to get the content, or see step 2 of the onboard instructions.

    line 185
  16. Distinctive:

    If using Claude or MCP-compatible clients, install the beads MCP server:

    line 189
  17. Very specific:

    Add to MCP config (e.g., ~/.config/claude/config.json):

    line 195
  18. Very specific:

    Create a history/ directory in the project root

    line 217
  19. Distinctive:

    Keep the repository root clean and focused on permanent project files

    line 219
  20. Very specific:

    Only access history/ when explicitly asked to review past planning

    line 220
  21. Very specific:

    Run bd <command> --help to see all available flags for any command.

    line 237

≈ “Common” is an estimate: at least 1 in 5 of the 36,368 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

Agent Guidelines

Commands

  • Typecheck: bun run typecheck
  • Install deps: bun install
  • No tests configured

Code Style

  • TypeScript strict mode with ESM modules
  • Use import type for type-only imports (verbatimModuleSyntax)
  • Node.js imports use node: prefix (e.g., node:fs/promises)
  • Handle undefined from indexed access (noUncheckedIndexedAccess enabled)
  • camelCase for functions/variables, PascalCase for types/interfaces
  • JSDoc comments for function documentation
  • Async/await for async operations

Project Structure

  • src/plugin.ts - Main plugin entry point
  • src/vendor.ts - Vendor file loaders
  • vendor/ - Synced content from upstream beads repo (commands, agents)

Notes

  • This is an OpenCode plugin integrating the beads issue tracker
  • Vendor files are synced via scripts/sync-beads.sh - don't edit directly

Releasing a New Version

Triggers: User says "bump the version", "cut a new release", "release a new version", "let's do a release", or similar.

Determining the Version

If the user specifies a version number (e.g., "bump to 0.4.0") or bump type (major/minor/patch), use that. Otherwise:

  1. Find the current version in package.json
  2. Fetch tags from remote: git fetch origin --tags
  3. Get commits since last release: git log v<current>..HEAD --oneline
  4. Read the actual diffs - don't rely solely on commit messages:
    • git diff v<current>..HEAD -- src/ for source changes
    • git diff v<current>..HEAD -- vendor/ for vendor syncs
  5. Apply semver:
    • patch (0.0.x): Bug fixes, dependency updates, vendor syncs with no breaking changes
    • minor (0.x.0): New features, new commands, non-breaking enhancements
    • major (x.0.0): Breaking changes to plugin API or behavior

Files to Update

  1. package.json - Update "version" field
  2. CHANGELOG.md:
    • Move content from ## [Unreleased] to new version section
    • Add new version heading: ## [X.Y.Z]
    • Update [unreleased] compare link at bottom to compare from new version
    • Add new version release link at the end of the reference links list
  3. README.md - Update version in the installation example JSON

Commit Convention

Use this exact format:

:bookmark: bump version X.Y.Z -> A.B.C

Checklist

  • All three files updated with consistent version
  • CHANGELOG has actual changes listed (not empty)
  • CHANGELOG links point to correct versions
  • Single commit with all version bump changes
  • User will cut the GitHub release after merge

Issue Tracking with bd (beads)

IMPORTANT: This project uses bd (beads) for ALL issue tracking. Do NOT use markdown TODOs, task lists, or other tracking methods.

Why bd?

  • Dependency-aware: Track blockers and relationships between issues
  • Git-friendly: Auto-syncs to JSONL for version control
  • Agent-optimized: JSON output, ready work detection, discovered-from links
  • Prevents duplicate tracking systems and confusion

Quick Start

Check for ready work:

bd ready --json

Create new issues:

bd create "Issue title" -t bug|feature|task -p 0-4 --json
bd create "Issue title" -p 1 --deps discovered-from:bd-123 --json
bd create "Subtask" --parent <epic-id> --json  # Hierarchical subtask (gets ID like epic-id.1)

Claim and update:

bd update bd-42 --status in_progress --json
bd update bd-42 --priority 1 --json

Complete work:

bd close bd-42 --reason "Completed" --json

Issue Types

  • bug - Something broken
  • feature - New functionality
  • task - Work item (tests, docs, refactoring)
  • epic - Large feature with subtasks
  • chore - Maintenance (dependencies, tooling)

Priorities

  • 0 - Critical (security, data loss, broken builds)
  • 1 - High (major features, important bugs)
  • 2 - Medium (default, nice-to-have)
  • 3 - Low (polish, optimization)
  • 4 - Backlog (future ideas)

Workflow for AI Agents

  1. Check ready work: bd ready shows unblocked issues
  2. Claim your task: bd update <id> --status in_progress
  3. Work on it: Implement, test, document
  4. Discover new work? Create linked issue:
    • bd create "Found bug" -p 1 --deps discovered-from:<parent-id>
  5. Complete: bd close <id> --reason "Done"
  6. Commit together: Always commit the .beads/issues.jsonl file together with the code changes so issue state stays in sync with code state

Writing Self-Contained Issues

Issues must be fully self-contained - readable without any external context (plans, chat history, etc.). A future session should understand the issue completely from its description alone.

Required elements:

  • Summary: What and why in 1-2 sentences
  • Files to modify: Exact paths (with line numbers if relevant)
  • Implementation steps: Numbered, specific actions
  • Example: Show before → after transformation when applicable

Optional but helpful:

  • Edge cases or gotchas to watch for
  • Test references (point to test files or test_data examples)
  • Dependencies on other issues

Bad example:

Implement the refactoring from the plan

Good example:

Add timeout parameter to fetchUser() in src/api/users.ts

1. Add optional timeout param (default 5000ms)
2. Pass to underlying fetch() call
3. Update tests in src/api/users.test.ts

Example: fetchUser(id) → fetchUser(id, { timeout: 3000 })
Depends on: bd-abc123 (fetch wrapper refactor)

Dependencies: Think "Needs", Not "Before"

bd dep add X Y = "X needs Y" = Y blocks X

TRAP: Temporal words ("Phase 1", "before", "first") invert your thinking!

WRONG: "Phase 1 before Phase 2" → bd dep add phase1 phase2
RIGHT: "Phase 2 needs Phase 1" → bd dep add phase2 phase1

Verify: bd blocked - tasks blocked by prerequisites, not dependents.

Auto-Sync

bd automatically syncs with git:

  • Exports to .beads/issues.jsonl after changes (5s debounce)
  • Imports from JSONL when newer (e.g., after git pull)
  • No manual export/import needed!

GitHub Copilot Integration

If using GitHub Copilot, also create .github/copilot-instructions.md for automatic instruction loading. Run bd onboard to get the content, or see step 2 of the onboard instructions.

MCP Server (Recommended)

If using Claude or MCP-compatible clients, install the beads MCP server:

pip install beads-mcp

Add to MCP config (e.g., ~/.config/claude/config.json):

{
  "beads": {
    "command": "beads-mcp",
    "args": []
  }
}

Then use mcp__beads__* functions instead of CLI commands.

Managing AI-Generated Planning Documents

AI assistants often create planning and design documents during development:

  • PLAN.md, IMPLEMENTATION.md, ARCHITECTURE.md
  • DESIGN.md, CODEBASE_SUMMARY.md, INTEGRATION_PLAN.md
  • TESTING_GUIDE.md, TECHNICAL_DESIGN.md, and similar files

Best Practice: Use a dedicated directory for these ephemeral files

Recommended approach:

  • Create a history/ directory in the project root
  • Store ALL AI-generated planning/design docs in history/
  • Keep the repository root clean and focused on permanent project files
  • Only access history/ when explicitly asked to review past planning

Example .gitignore entry (optional):

# AI planning documents (ephemeral)
history/

Benefits:

  • ✅ Clean repository root
  • ✅ Clear separation between ephemeral and permanent documentation
  • ✅ Easy to exclude from version control if desired
  • ✅ Preserves planning history for archeological research
  • ✅ Reduces noise when browsing the project

CLI Help

Run bd <command> --help to see all available flags for any command. For example: bd create --help shows --parent, --deps, --assignee, etc.

Important Rules

  • ✅ Use bd for ALL task tracking
  • ✅ Always use --json flag for programmatic use
  • ✅ Link discovered work with discovered-from dependencies
  • ✅ Check bd ready before asking "what should I work on?"
  • ✅ Store AI planning docs in history/ directory
  • ✅ Run bd <cmd> --help to discover available flags
  • ❌ Do NOT create markdown TODO lists
  • ❌ Do NOT use external issue trackers
  • ❌ Do NOT duplicate tracking systems
  • ❌ Do NOT clutter repo root with planning documents

For more details, see README.md and QUICKSTART.md.

Download now (ZIP)

  • 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 28,693 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.

  • In this repository2 other files it gives its agents.

Does it work?

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

Reviews can't be read right now.

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.