agentleFS
kunwarVivekkunwarVivek/mcp-github-project-manager/AGENTS.md

mcp-github-project-manager

AGENTS.md101 starsChanged 2 months agoMITView on GitHub

- src/index.ts — entry; boots an McpServer (@modelcontextprotocol/server v2, 2026-07-28 spec) via serveStdio, which negotiates the protocol revision per connection. Each tool is registered with registerTool; all of them share one dispatchTool carrying the shutdown gate, in-flight tracking and result formatting. Wires ToolRegistry + ProjectManagementService through src/container.ts (tsyringe DI). - Tool errors: an execution failure returns {content, isError: true} so the model can see and recover from it. A JSON-RPC error is reserved for protocol faults (unknown tool). Note v2…

  • Reads credentials
  • Commits and pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,736 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 repository8 other files it gives its agents.

The file

Show its rules and text

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

19 rules. About 0 are common, 6 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

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

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

    Every credential read goes through getSecret()/requireToken().

    line 47
  2. Very specific:

    Do NOT reintroduce zod-to-json-schema: it does not support zod 4 and returns {type:'object'} with no properties — silently, with no error — …

    line 77
  3. Very specific:

    Test mocks must use function, not an arrow, wherever the code under test calls new — mockImplementation(() => ({...})) fails with "is not a …

    line 89
  4. Very specific:

    MUST run impact before editing: Use impact({target: "symbolName", direction: "upstream"}) or node .gitnexus/run.cjs impact "symbolName" …

    line 123
  5. Very specific:

    MUST analyze graph changes before committing: Use detect_changes({scope: "all"}) (MCP) or node .gitnexus/run.cjs detect-changes --scope all …

    line 124
  6. Very specific:

    MUST warn on HIGH/CRITICAL risk pre-edit.

    line 125
  7. Distinctive:

    NEVER edit a function, class, or method before MCP/CLI impact analysis.

    line 132
  8. Very specific:

    NEVER ignore HIGH or CRITICAL risk warnings from impact analysis, and never read UNKNOWN as an all-clear — it means the walk could not …

    line 133
  9. Very specific:

    NEVER rename symbols with find-and-replace — use rename which understands the call graph.

    line 134
  10. Distinctive:

    NEVER commit before MCP/CLI graph change analysis.

    line 135
  11. Very specific:

    Use bd for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists

    line 175
  12. Very specific:

    Run bd prime for detailed command reference and session close protocol

    line 176
  13. Very specific:

    Use bd remember for persistent knowledge — do NOT use MEMORY.md files

    line 177
  14. Very specific:

    Conservative (default): Use bd for task tracking. Do not run git commits, git pushes, or Dolt remote sync unless explicitly asked.

    line 185
  15. Very specific:

    Minimal: Keep tool instruction files as pointers to bd prime.

    line 186
  16. Distinctive:

    Team-maintainer: Only when the repository explicitly opts in, agents may close beads, run quality gates, commit, and push as part of …

    line 187
  17. Distinctive:

    File issues for remaining work: - Create beads for anything that needs follow-up

    line 193
  18. Distinctive:

    Do not commit or push without clear authority from the active profile or the current user request.

    line 211
  19. Distinctive:

    If a required sync or push is blocked, stop and report the exact command and error.

    line 212

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 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
<!-- project-manual:start -->

Commands

TaskCommand
Buildnpm run build (tsc → fix-imports.js → chmod)
Dev (watch)npm run dev (tsx — ts-node cannot load under TS 7)
Unit testsnpm test · core only npm run test:core · AI npm run test:ai
E2E (mock)npm run test:e2e · tools npm run test:e2e:tools
E2E (live API)E2E_REAL_API=true npm run test:e2e:tools:real
Coveragenpm run test:coverage
Lint / formatnpm run lint (Biome) · npm run format
Inspect MCP servernpm run inspect

Architecture (DDD, MCP stdio server)

  • src/index.ts — entry; boots an McpServer (@modelcontextprotocol/server v2, 2026-07-28 spec) via serveStdio, which negotiates the protocol revision per connection. Each tool is registered with registerTool; all of them share one dispatchTool carrying the shutdown gate, in-flight tracking and result formatting. Wires ToolRegistry + ProjectManagementService through src/container.ts (tsyringe DI).
  • Tool errors: an execution failure returns {content, isError: true} so the model can see and recover from it. A JSON-RPC error is reserved for protocol faults (unknown tool). Note v2 validates arguments against the declared inputSchema before the handler runs, so ToolValidator never sees a missing required field.
  • src/domain/ — types, zod schemas, errors. No logic.
  • src/services/ — business logic. ProjectManagementService orchestrates per-feature services; services/ai/ holds AI SDK providers.
  • src/infrastructure/ — github/ (Octokit GraphQL/REST), tools/ (MCP tool defs + registry + validators), plus cache, persistence, resilience, events.
  • src/env.ts + src/cli.ts — config. CLI flags override env vars.

Environment (.env or CLI flags; CLI wins)

  • Required: GITHUB_TOKEN, GITHUB_OWNER, GITHUB_REPO.
  • GitHub credential chain, first hit wins: --token CLI flag → $SECRETS_DIR/GITHUB_TOKEN file → GITHUB_TOKEN env → gh auth token. The gh fallback means a developer with a working gh login needs no configuration at all; disable it with GH_CLI_TOKEN_FALLBACK=false (it is also off automatically under NODE_ENV=test, so tests never shell out).
  • GitHub App installation auth (optional, outranks the PAT when all three are set): GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY, GITHUB_APP_INSTALLATION_ID. A partial App config falls back to the PAT rather than failing, so a half-set environment cannot lock the server out.
  • Every credential read goes through getSecret()/requireToken(). Do NOT read process.env.GITHUB_TOKEN directly — that bypasses the whole chain, which is exactly how SECRETS_DIR and --token were silently broken before.
  • AI (optional, unlocks AI tools): ANTHROPIC_API_KEY, GOOGLE_API_KEY, OPENAI_API_KEY, PERPLEXITY_API_KEY; model overrides AI_MAIN_MODEL, AI_PRD_MODEL, AI_RESEARCH_MODEL, AI_FALLBACK_MODEL.
  • Optional: SYNC_ENABLED, SYNC_TIMEOUT_MS, CACHE_DIRECTORY, WEBHOOK_SECRET, WEBHOOK_PORT, SSE_ENABLED.
  • Webhook security: signature validation fails closed. With no WEBHOOK_SECRET, webhooks are rejected unless WEBHOOK_ALLOW_UNSIGNED=true (trusted dev only).
  • Secrets: set SECRETS_DIR (e.g. /run/secrets) to load any config/secret from a file named after it (Docker/k8s secret convention), checked before env vars. getSecret(name) in env.ts reads fresh (rotation-aware). Vault/AWS SM are an extension point via SecretProvider (src/infrastructure/secrets/).
  • Startup validation runs against the resolved config, not raw process.env — validating the environment directly meant a token supplied by file or CLI flag failed the required-field check and the process exited before the resolver ran.
  • Logs are redacted: redactSecrets() in infrastructure/logger strips token/secret/password/apiKey/authorization-shaped keys from anything the logger stringifies, and GitHubConfig.token is non-enumerable so JSON.stringify cannot emit the PAT.

Gotchas

  • ESM extensions: source omits .js in imports; postbuild runs scripts/fix-imports.js to add them. Never ship raw tsc output — always npm run build.
  • zod is on v4 (^4.4.3), paired with ai@^7 / @ai-sdk/*@^4 (peer-accept ^4.1.8) and @modelcontextprotocol/server@^2. Tool JSON Schema is generated by zod 4's native z.toJSONSchema({io:'input'}) in ToolRegistry. Do NOT reintroduce zod-to-json-schema: it does not support zod 4 and returns {type:'object'} with no properties — silently, with no error — which left every tool advertising a parameterless schema. Guarded by src/__tests__/unit/infrastructure/tools/schema-generation.test.ts. zod-4 gotchas: z.record needs an explicit key schema (z.record(z.string(), v)); ZodError.errors → .issues; .nonstrict() removed (objects strip by default).
  • Tests run on Vitest 4 (not Jest). Vitest rejects Jest-only CLI flags outright — --testPathPattern / --testPathIgnorePatterns exit with CACError: Unknown option, which silently broke 17 npm scripts. Filter by positional pattern (vitest run ai-services) and exclude with --exclude='**/tests/x/**'.
  • Test mocks must use function, not an arrow, wherever the code under test calls new — mockImplementation(() => ({...})) fails with "is not a constructor". Likewise a beforeEach(() => x.mockReset()) with an implicit return hands the mock back to Vitest, which treats a returned function as a teardown callback and calls it; always use a block body.
  • E2E tool tests mock GitHub by default; E2E_REAL_API=true hits the live API and consumes rate limit.
  • isolatedModules is ON. Every file must transpile independently, so a type re-exported as a value is an error. tsc elides those; tsx/esbuild/bundlers emit a real runtime import that then fails to resolve. Use export type / import type — including for decorated constructor params, whose types emitDecoratorMetadata references at runtime.
  • Agent token budgets are metered server-side: AIServiceFactory.getModel wraps every model with middleware that accumulates provider-reported usage into CorrelationContext's AsyncLocalStorage, and dispatchTool debits the agent's budget once per tool call (never per AI call — AgentStore is GitHub-backed and does unlocked read-modify-write). This covers only what the server spends; an agent's own runtime spend never reaches this process, so record_usage remains the channel for that.
  • ai@7 reports usage as inputTokens: {total,...} / outputTokens: {total,...} — objects, not numbers. Reading them as numbers yields NaN.

AGENTS.md and CLAUDE.md are kept identical. Edit both together.

<!-- project-manual:end --><!-- gitnexus:start -->

GitNexus — Code Intelligence

This project is indexed by GitNexus as mcp-github-project-manager (13281 symbols, 30563 relationships, 676 execution flows).

Index stale? Run node .gitnexus/run.cjs analyze --index-only from the project root — it auto-selects an available runner. No .gitnexus/run.cjs yet? Bootstrap with npx, bunx, or pnpm dlx — e.g. bunx gitnexus@latest analyze (npm 11 npx crash; #1939).

Always Do

  • MUST run impact before editing. Use impact({target: "symbolName", direction: "upstream"}) or node .gitnexus/run.cjs impact "symbolName" --direction upstream --repo .; report callers, processes, and risk. Never substitute grep for graph analysis.
  • MUST analyze graph changes before committing. Use detect_changes({scope: "all"}) (MCP) or node .gitnexus/run.cjs detect-changes --scope all --repo . (CLI fallback). partial: true or truncated: true is not a clean check — a zero means unseen, not unaffected; re-run it. For regression review: detect_changes({scope: "compare", base_ref: "main"}) or node .gitnexus/run.cjs detect-changes --scope compare --base-ref "main" --repo ..
  • MUST warn on HIGH/CRITICAL risk pre-edit; never use riskSharedAxes to waive a HIGH/CRITICAL risk warning. Compare File/symbol: MCP File omits axes; Graph-RAG expands File.
  • MUST treat risk: UNKNOWN as unresolved, not as low. An empty caller set is not evidence the symbol is unused — it can also mean the callers are not resolvable by the index (plain-object property access, dynamic dispatch, cross-language calls). impact pairs UNKNOWN with a riskNote saying so. Confirm with a text search before treating the symbol as safe to change or delete; do not proceed on the strength of a zero.
  • MUST use query({search_query: "concept"}) for concepts/flows, context({name: "symbolName"}) for a named symbol, or impact for blast radius, on read-only callers, dependencies, imports, or execution flow. Graph first; text search only for empty/UNKNOWN/literals.
  • For security review, explain({target: "fileOrSymbol"}) lists taint findings (source→sink flows; needs analyze --pdg).

Never Do

  • NEVER edit a function, class, or method before MCP/CLI impact analysis.
  • NEVER ignore HIGH or CRITICAL risk warnings from impact analysis, and never read UNKNOWN as an all-clear — it means the walk could not answer, which is the one verdict that requires confirming by other means.
  • NEVER rename symbols with find-and-replace — use rename which understands the call graph.
  • NEVER commit before MCP/CLI graph change analysis.

Resources

ResourceUse for
gitnexus://repo/mcp-github-project-manager/contextCodebase overview, check index freshness
gitnexus://repo/mcp-github-project-manager/clustersAll functional areas
gitnexus://repo/mcp-github-project-manager/processesAll execution flows
gitnexus://repo/mcp-github-project-manager/process/{name}Step-by-step execution trace

CLI

TaskRead this skill file
Understand architecture / "How does X work?".claude/skills/gitnexus-exploring/SKILL.md
Blast radius / "What breaks if I change X?".claude/skills/gitnexus-impact-analysis/SKILL.md
Trace bugs / "Why is X failing?".claude/skills/gitnexus-debugging/SKILL.md
Rename / extract / split / refactor.claude/skills/gitnexus-refactoring/SKILL.md
Tools, resources, schema reference.claude/skills/gitnexus-guide/SKILL.md
Index, status, clean, wiki CLI commands.claude/skills/gitnexus-cli/SKILL.md
<!-- gitnexus:end --><!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:970c3bf2 -->

Beads Issue Tracker

This project uses bd (beads) for issue tracking. Run bd prime to see full workflow context and commands.

Quick Reference

bd ready              # Find available work
bd show <id>          # View issue details
bd update <id> --claim  # Claim work
bd close <id>         # Complete work

Rules

  • Use bd for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
  • Run bd prime for detailed command reference and session close protocol
  • Use bd remember for persistent knowledge — do NOT use MEMORY.md files

Architecture in one line: issues live in a local Dolt DB; sync uses refs/dolt/data on your git remote; .beads/issues.jsonl is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/SYNC_CONCEPTS.md for details and anti-patterns.

Agent Context Profiles

The managed Beads block is task-tracking guidance, not permission to override repository, user, or orchestrator instructions.

  • Conservative (default): Use bd for task tracking. Do not run git commits, git pushes, or Dolt remote sync unless explicitly asked. At handoff, report changed files, validation, and suggested next commands.
  • Minimal: Keep tool instruction files as pointers to bd prime; use the same conservative git policy unless active instructions say otherwise.
  • Team-maintainer: Only when the repository explicitly opts in, agents may close beads, run quality gates, commit, and push as part of session close. A current "do not commit" or "do not push" instruction still wins.

Session Completion

This protocol applies when ending a Beads implementation workflow. It is subordinate to explicit user, repository, and orchestrator instructions.

  1. File issues for remaining work - Create beads for anything that needs follow-up
  2. Run quality gates (if code changed) - Tests, linters, builds
  3. Update issue status - Close finished work, update in-progress items
  4. Handle git/sync by active profile:
    # Conservative/minimal/default: report status and proposed commands; wait for approval.
    git status
    
    # Team-maintainer opt-in only, unless current instructions forbid it:
    git pull --rebase
    bd dolt push
    git push
    git status
  5. Hand off - Summarize changes, validation, issue status, and any blocked sync/commit/push step

Critical rules:

  • Explicit user or orchestrator instructions override this Beads block.
  • Do not commit or push without clear authority from the active profile or the current user request.
  • If a required sync or push is blocked, stop and report the exact command and error.
<!-- END BEADS INTEGRATION -->

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.