agentleFS
nrslibnrslib/takt/CLAUDE.md

takt

CLAUDE.md1.4k starsChanged 57 days agoMITView on GitHub

This file is not user-facing documentation. It exists for Claude Code to read while working in the repository — it does not substitute for the real docs under docs/ or README.md. Content being recorded here NEVER implies "we don't need to write this up for users." Anything users should see must still be added to README.md / docs/** separately. TAKT (TAKT Agent Koordination Topology) is a multi-agent orchestration CLI. It runs AI agents through YAML-defined workflows with rule-based routing, parallel…

  • Reads credentials

Trending

Less talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 1 mentionMar 2026: 1 mentionApr 2026: 3 mentionsMay 2026: 2 mentionsJun 2026: 12 mentionsJul 2026: 7 mentionsAug 2026: 8 mentionsSep 2026: 6 mentionsOct 2026: 3 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the nrslib/takt repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about nrslib/takt

The biggest 5 of 43 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 43

Talked about on GitHub and Bluesky (43 times).

On GitHub · 42

37 more on GitHub
  • In this repositoryOne other file it gives its agents.

The file

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

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    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. Very specific:

    Prefer simple code over defensive fallback-heavy logic.

    line 142
  2. Very specific:

    Don't commit secrets; provider keys live in env vars or ~/.takt/config.yaml.

    line 144

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

This file is not user-facing documentation. It exists for Claude Code to read while working in the repository — it does not substitute for the real docs under docs/ or README.md. Content being recorded here NEVER implies "we don't need to write this up for users." Anything users should see must still be added to README.md / docs/** separately.

Project Overview

TAKT (TAKT Agent Koordination Topology) is a multi-agent orchestration CLI. It runs AI agents through YAML-defined workflows with rule-based routing, parallel review, dynamic task decomposition, and worktree-isolated execution. This repository dogfoods TAKT for its own review and development.

Development Commands

CommandNotes
npm run buildtsc (+ opencode-probe tsconfig) plus copies of src/shared/prompts/{en,ja}/**/*.md, src/shared/i18n/*.yaml, and src/core/runtime/presets/*.sh into dist/. Skipping any copy breaks runtime resolution.
npm run watchTypeScript incremental build (no asset copy).
npm run lintESLint on src/. no-explicit-any is error; unused vars must be prefixed _.
npm testFast unit gate: type-contracts tsc, the test type-check (tsconfig.tests.json), then an adaptive number of unit shards launched concurrently (capped at 8 from availableParallelism() in scripts/run-npm-test.mjs, each shard --maxWorkers=1). Excludes integration tests; the output names the follow-up command.
npm run test:itLight integration gate for real filesystem, bounded storage, and multi-component contracts. Run after implementation.
npm run test:it:heavyFull heavy integration gate for real child processes, Git, complete engines, integration/regression/performance suites, and serial groups. Local execution uses one worker; PR CI shards across isolated runners.
npm test -- src/__tests__/<file>.test.tsRoute a single file to the correct unit, light-IT, heavy-parallel-IT, or heavy-serial-IT runner. For an added or changed IT, also run releaseVerificationWiring.test.ts by itself. Always target-run an added or changed heavy IT before handoff.
npm test -- -t "<pattern>"Run unit tests whose name matches <pattern>.
npm run test:opencode-probeDeterministic OpenCode probe smoke gate (11 cases, no API cost). Standalone; not part of routine gates or check:release.
npm run test:e2e:mockFull mock-provider E2E suite (parallel shards). Single spec: TAKT_E2E_PROVIDER=mock npx vitest run --config vitest.config.e2e.mock.ts e2e/specs/<file>.e2e.ts — without that env var the specs run against the real provider (provider: claude in e2e/fixtures/config.e2e.yaml) and cost API credits.
npm run test:e2e:provider:{claude,claude-sdk,codex,opencode,cursor}E2E against a real provider (slow, costs API credits).
npm run check:releaseFull pre-release gate: build + lint + adaptive local unit + light IT + heavy IT + e2e. The main pull-request CI workflow runs the unit gate separately in 8 isolated shard jobs; local check:release does not run that CI matrix.

Vitest strips types, so a test only gets type-checked if it is listed in tsconfig.tests.json. Add the test you wrote or changed to that list; if an older test does not type-check yet, fix it first rather than leaving it off.

Test pool behavior (worth knowing before "fixing" flakes)

  • Test-layer membership lives in scripts/test-classification.mjs. lightIntegrationTestFiles covers bounded filesystem/storage and component contracts; heavyParallelIntegrationTestFiles, integration filename globs, and the serial groups cover real processes, Git, full engines, and measured IO interference. releaseVerificationWiring.test.ts fails if a listed file does not exist, overlaps another group, or leaves an observed boundary in unit.
  • dangerouslyIgnoreUnhandledErrors: !process.env.CI (vitest.config.shared.ts): the spurious [vitest-worker]: Timeout calling "onTaskUpdate" error is tolerated locally (the adaptive concurrent unit-shard wave on one machine) but fatal on CI. Heavy parallel IT always uses one worker per runner; PR CI scales out through six isolated job-level shards, while local full-heavy execution stays serial. The on-demand /ci workflow is the single-runner CI exception.
  • Because that noise still makes a shard exit non-zero locally, npm test re-measures such a shard once (scripts/vitest-birpc-noise.mjs): only when the shard's own output shows zero failed tests, at least one passed test, and no reported error other than [vitest-worker]: Timeout calling "onTaskUpdate". One real test failure, one unrecognized error headline, or CI set without TAKT_BIRPC_REMEASURE_ON_CI=1 → no re-measurement, exit code stands. The /ci workflow opts into the same strict one-time re-measurement for its single-runner adaptive unit wave; the blocking PR matrix and mock E2E workflow do not. The re-measurement is announced on stderr; a silent shard exit is never rescued.
  • Reading that output means unit and mock E2E shards run through a pipe (scripts/teed-command.mjs) instead of inheriting the terminal, so npm test and npm run test:e2e:mock output is now non-TTY: no color and no live progress rewriting. That module takes the exit code from exit and gives close only a short deadline — a shard's grandchild can hold the stdout pipe open forever, and waiting on close alone hangs the gate.
  • src/__tests__/test-setup.ts clears TAKT_CONFIG_DIR / TAKT_NOTIFY_WEBHOOK per test and provides an isolated config root — don't add per-suite env overrides that fight it.

CLI Surface

Entry point: bin/takt → dist/app/cli/index.js (src/app/cli/index.ts). Subcommand definitions live in src/app/cli/commands.ts; argumentless/slash-fallback routing is in src/app/cli/routing.ts. See commands.ts for the full list rather than maintaining a copy here.

Two execution modes share the same engine: Interactive (src/features/interactive/; /go executes, /cancel aborts) and Pipeline (src/features/pipeline/, --pipeline; auto-branch/commit/push, --auto-pr, --skip-git).

Architecture

Layered layout (src/)

app/cli/       CLI entrypoint, command wiring, routing
core/          Engine internals — no IO providers here
  workflow/    Engine, step executors, rule evaluation, instruction builder
  config/      Workflow/global/project config models
  models/      Shared domain types + Zod schemas
  runtime/     Runtime environment & shell presets
features/      User-facing feature modules (interactive, pipeline, tasks, ...)
infra/         Adapters — providers, fs, git/github/gitlab,
               observability, config loaders
shared/        Constants, i18n, ui, utils, prompt templates
agents/        agent-usecases (executeAgent, generateReport, judgeStatus, ...)

Workflow execution

WorkflowEngine (src/core/workflow/engine/WorkflowEngine.ts) is an EventEmitter-driven state machine. Per-step dispatch: StepExecutor (normal, 3-phase), ParallelRunner (parallel:, Promise.allSettled + all()/any() aggregation), ArpeggioRunner (arpeggio: data-driven batch), TeamLeaderRunner (team_leader: runtime decomposition), WorkflowCallExecutor (workflow_call: subworkflow in the same run). LoopDetector catches consecutive same-step repeats; CycleDetector + loop_monitors catch cyclic patterns (judge personas routed under the fixed persona key loop-judge, not supervisor).

Three-phase step model

Each normal step runs up to three phases on the same provider session: Phase 1 main work (step's allowed_tools; Write excluded when a report is defined), Phase 2 report output (Write only, when output_contracts defined), Phase 3 status judgment (no tools, when tag-based rules exist). Implemented in phase-runner.ts / report-phase-runner.ts / status-judgment-phase.ts.

Rule evaluation (5-stage fallback)

src/core/workflow/evaluation/ — first match wins: (1) aggregate all()/any() for parallel parents, (2) Phase 3 [STEP:N] tag, (3) Phase 1 tag, (4) AI judge for ai("...") conditions, (5) AI judge over every condition. Deterministic when(...) expressions are evaluated before tags. Quirks: tag rules match by array index; multiple tags → last match wins; if rules exist but nothing matches the workflow fails fast — silently picking a default is a bug.

Instruction assembly

InstructionBuilder (src/core/workflow/instruction/) auto-injects execution context, workflow context, {task}, {previous_response}, {user_inputs}, and status output rules. Templates contain only step-specific content — never repeat what the builder injects. Facet markdown may include partials via {{include:instructions/<name>}} (resolved from facets/partials/).

Provider integration

src/infra/providers/ exposes a unified Provider interface. Registered: claude-sdk (default), claude (SDK alias), claude-headless (headless CLI), claude-terminal (interactive terminal), codex, opencode (shared server pool), pi (Pi SDK), deepseek-harness (official Python SDK bridge), cursor, copilot, kiro, mock. Provider errors must surface through AgentResponse.error — otherwise SDK failures appear as empty blocked output and are nearly impossible to debug. Use --provider mock to exercise the engine without a real API.

Provider/model resolution priority

Verified against resolveStepProviderModel / PROVIDER_MODEL_SOURCE_PRIORITY and runtime tests. Provider selection follows this priority. Model selection uses the first layer that specifies a model; if that same entry specifies a provider, the model is used only when its provider exactly matches the selected provider. On a mismatch, leave the model unset and do not try a lower-priority model. A model-only value passes through unchanged.

  1. CLI / environment explicit override
  2. Matching promotion (normal agent steps only — parallel sub-steps reject promotion at schema level)
  3. Step / parallel sub-step direct provider / model
  4. workflow_call override
  5. provider_routing.steps → provider_routing.tags → provider_routing.personas
  6. persona_providers (deprecated)
  7. Auto routing (auto.rules / auto.dynamic / auto.fallback)
  8. Workflow → project (.takt/config.yaml) → global (~/.takt/config.yaml) → provider default

Config & workflow loading

src/infra/config/loaders/. Workflow resolution is 3-layer with project priority: .takt/workflows/ → ~/.takt/workflows/ → bundled builtins/{lang}/workflows/. Zod schemas in src/core/models/schemas.ts (Zod v4). Load-time provider validation for workflow_call chains uses the same routing transformation helpers as runtime (workflow-call-provider-context.ts) — keep them shared; divergence between load-time and runtime resolution is a bug class we have shipped before.

Worktree-isolated execution

worktree: true runs a task in a clone created with git clone --reference <main-repo> --dissociate (plain git clone when the project is itself a linked worktree, or as fallback when the reference repo is shallow) — not a real git worktree, because Claude Code follows .git-file gitdir: pointers back to the main repo, which breaks isolation. Clones are ephemeral (auto-commit + push on success, deleted after), contain only tracked files, and cannot resume sessions (cwd !== projectCwd). cwd = clone path, projectCwd = repo root; reports go to cwd/.takt/runs/{slug}/reports/.

Faceted Prompting

Prompts are split into facet kinds — keep additions in the right bucket:

FacetHolds
personas/WHO — identity, expertise. Reusable across workflows; no workflow-specific procedures.
policies/HOW — REJECT/APPROVE criteria. Reviewers only enforce what's in policy.
knowledge/WHAT TO KNOW — domain patterns, anti-patterns, examples.
instructions/WHAT TO DO NOW — step-bound procedures.
partials/instructions/Shared fragments injected via {{include:...}}. Headless (no H1) by design.

Output contracts live under facets/output-contracts/. User overrides: ~/.takt/facets/<type>/ or .takt/facets/<type>/.

Runtime directory layout

~/.takt/                Global user config (config.yaml, workflows/, facets/, repertoire/)
.takt/                  Project config (highest priority)
  config.yaml           provider / provider_routing / quality gates / overrides
  workflows/, facets/   project-level overrides
  tasks.yaml, tasks/    queued task specs
  runs/{slug}/          per-run reports, logs, metadata, and context
  logs/, events/        NDJSON session logs / analytics (gitignored)
builtins/{en,ja}/       Bundled facets + workflows (read from dist/ at runtime)

TypeScript / testing

  • ESM ("type": "module"); import paths use .js extensions in .ts sources. Strict TS with noUncheckedIndexedAccess. Node ≥ 22.22 (floor set by dependency engines — pi SDK needs 22.19, dev-only posthog-node/promptfoo need 22.22; see engines in package.json).
  • Unit and integration tests live under src/__tests__/ (Vitest); E2E specs under e2e/ with per-provider configs.

Debugging

  • logging.debug: true in ~/.takt/config.yaml → debug logs under .takt/runs/debug-{timestamp}/logs/. TAKT_VERBOSE=true for verbose console. Session logs at .takt/logs/{sessionId}.jsonl.
  • OpenCode's composed system prompt cannot be read from the binary or SDK; tools/opencode-probe/sdk-prompt-capture.mjs points OpenCode at a local OpenAI-compatible probe endpoint and records real request bodies. Facts established with it (re-verify — OpenCode changes): the system prompt concatenates agent.prompt + the user's ~/.claude/CLAUDE.md + skills + config.instructions; every prompt triggers a thread-title call on small_model before the real one (capture tooling that grabs the first request measures the title generator). Do not use opencode run (CLI) as a measurement instrument — it intermittently hangs; production uses createOpencode from the SDK.

House conventions (from AGENTS.md / CONTRIBUTING.md)

  • Prefer simple code over defensive fallback-heavy logic. TAKT is a local tool: no audit trails, tamper-resistance, or security theater.
  • Filenames mostly kebab-case. Conventional Commit style with occasional (#issue) suffix.
  • Don't commit secrets; provider keys live in env vars or ~/.takt/config.yaml.
  • For CodeRabbit comments: judge each, act on the valid ones, resolve every thread; don't post replies.

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.