takt
v0.5.0
Published
TAKT: Task Agent Koordination Tool - AI Agent Piece Orchestration
Downloads
2,257
Maintainers
Readme
TAKT
🇯🇵 日本語ドキュメント
Task Agent Koordination Tool - A governance-first orchestrator for running coding agents safely and responsibly
TAKT coordinates AI agents like Claude Code and Codex according to your organization's rules and pieces. It clarifies who is responsible, what is permitted, and how to recover from failures, while automating complex development tasks.
TAKT is built with TAKT itself (dogfooding).
Metaphor
TAKT uses a music metaphor to describe orchestration:
- Piece: A task execution definition (what to do and how agents coordinate)
- Movement: A step inside a piece (a single stage in the flow)
- Orchestration: The engine that coordinates agents across movements
You can read every term as standard workflow language (piece = workflow, movement = step), but the metaphor is used to keep the system conceptually consistent.
TAKT is For Teams That Need
- Want to integrate AI into CI/CD but fear runaway execution — Clarify control scope with piece definitions
- Want automated PR generation but need audit logs — Record and track all execution history
- Want to use multiple AI models but manage them uniformly — Control Claude/Codex/Mock with the same piece
- Want to reproduce and debug agent failures — Maintain complete history with session logs and reports
What TAKT is NOT
- Not an autonomous engineer — TAKT doesn't complete implementations itself; it governs and coordinates multiple agents
- Not competing with Claude Code Swarm — While leveraging Swarm's execution power, TAKT provides "operational guardrails" such as piece definitions, permission controls, and audit logs
- Not just a piece engine — TAKT is designed to address AI-specific challenges (non-determinism, accountability, audit requirements, and reproducibility)
Requirements
Choose one:
- Use provider CLIs: Claude Code or Codex installed
- Use direct API: Anthropic API Key or OpenAI API Key (no CLI required)
Additionally required:
- GitHub CLI (
gh) — Only needed fortakt #N(GitHub Issue execution)
Pricing Note: When using API Keys, TAKT directly calls the Claude API (Anthropic) or OpenAI API. The pricing structure is the same as using Claude Code or Codex. Be mindful of costs, especially when running automated tasks in CI/CD environments, as API usage can accumulate.
Installation
npm install -g taktQuick Start
# Interactive mode - refine task requirements with AI, then execute
takt
# Execute GitHub Issue as task (both work the same)
takt #6
takt --issue 6
# Pipeline execution (non-interactive, for scripts/CI)
takt --pipeline --task "Fix the bug" --auto-prUsage
Interactive Mode
A mode where you refine task content through conversation with AI before execution. Useful when task requirements are ambiguous or when you want to clarify content while consulting with AI.
# Start interactive mode (no arguments)
takt
# Specify initial message (short word only)
takt helloNote: If you specify a string with spaces, Issue reference (#6), or --task / --issue options, interactive mode will be skipped and the task will be executed directly.
Flow:
- Select piece
- Refine task content through conversation with AI
- Finalize task instructions with
/go(you can also add additional instructions like/go additional instructions) - Execute (create worktree, run piece, create PR)
Execution Example
$ takt
Select piece:
❯ 🎼 default (current)
📁 Development/
📁 Research/
Cancel
Interactive mode - Enter task content. Commands: /go (execute), /cancel (exit)
> I want to add user authentication feature
[AI confirms and organizes requirements]
> /go
Proposed task instructions:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Implement user authentication feature.
Requirements:
- Login with email address and password
- JWT token-based authentication
- Password hashing (bcrypt)
- Login/logout API endpoints
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Proceed with these task instructions? (Y/n) y
? Create worktree? (Y/n) y
[Piece execution starts...]Direct Task Execution
When task content is clear, you can skip interactive mode and execute directly.
# Specify task content directly (string with spaces)
takt "Add login feature"
# Specify task content with --task option
takt --task "Fix bug"
# Specify piece
takt "Add authentication" --piece expert
# Auto-create PR
takt "Fix bug" --auto-prGitHub Issue Tasks
You can execute GitHub Issues directly as tasks. Issue title, body, labels, and comments are automatically incorporated as task content.
# Execute by specifying issue number
takt #6
takt --issue 6
# Issue + piece specification
takt #6 --piece expert
# Issue + auto-create PR
takt #6 --auto-prRequirements: GitHub CLI (gh) must be installed and authenticated.
Task Management (add / run / watch / list)
Batch processing using task files (.takt/tasks/). Useful for accumulating multiple tasks and executing them together later.
Add Task (takt add)
# Refine task requirements through AI conversation, then add task
takt add
# Add task from GitHub Issue (issue number reflected in branch name)
takt add #28Execute Tasks (takt run)
# Execute all pending tasks in .takt/tasks/
takt runWatch Tasks (takt watch)
# Monitor .takt/tasks/ and auto-execute tasks (resident process)
takt watchList Task Branches (takt list)
# List task branches (merge/delete)
takt listPipeline Mode (for CI/Automation)
Specifying --pipeline enables non-interactive pipeline mode. Automatically creates branch → runs piece → commits & pushes. Suitable for CI/CD automation.
# Execute task in pipeline mode
takt --pipeline --task "Fix bug"
# Pipeline execution + auto-create PR
takt --pipeline --task "Fix bug" --auto-pr
# Link issue information
takt --pipeline --issue 99 --auto-pr
# Specify piece and branch
takt --pipeline --task "Fix bug" -w magi -b feat/fix-bug
# Specify repository (for PR creation)
takt --pipeline --task "Fix bug" --auto-pr --repo owner/repo
# Piece execution only (skip branch creation, commit, push)
takt --pipeline --task "Fix bug" --skip-git
# Minimal output mode (for CI)
takt --pipeline --task "Fix bug" --quietIn pipeline mode, PRs are not created unless --auto-pr is specified.
GitHub Integration: When using TAKT in GitHub Actions, see takt-action. You can automate PR reviews and task execution. Refer to the CI/CD Integration section for details.
Other Commands
# Interactively switch pieces
takt switch
# Copy builtin pieces/agents to ~/.takt/ for customization
takt eject
# Clear agent conversation sessions
takt clear
# Configure permission mode
takt configRecommended Pieces
| Piece | Recommended Use |
|----------|-----------------|
| default | Serious development tasks. Used for TAKT's own development. Multi-stage review with parallel reviews (architect + security). |
| minimal | Simple fixes and straightforward tasks. Minimal piece with basic review. |
| review-fix-minimal | Review & fix piece. Specialized for iterative improvement based on review feedback. |
| research | Investigation and research. Autonomously executes research without asking questions. |
Main Options
| Option | Description |
|--------|-------------|
| --pipeline | Enable pipeline (non-interactive) mode — Required for CI/automation |
| -t, --task <text> | Task content (alternative to GitHub Issue) |
| -i, --issue <N> | GitHub issue number (same as #N in interactive mode) |
| -w, --piece <name or path> | Piece name or path to piece YAML file |
| -b, --branch <name> | Specify branch name (auto-generated if omitted) |
| --auto-pr | Create PR (interactive: skip confirmation, pipeline: enable PR) |
| --skip-git | Skip branch creation, commit, and push (pipeline mode, piece-only) |
| --repo <owner/repo> | Specify repository (for PR creation) |
| --create-worktree <yes\|no> | Skip worktree confirmation prompt |
| -q, --quiet | Minimal output mode: suppress AI output (for CI) |
| --provider <name> | Override agent provider (claude|codex|mock) |
| --model <name> | Override agent model |
Pieces
TAKT uses YAML-based piece definitions and rule-based routing. Builtin pieces are embedded in the package, with user pieces in ~/.takt/pieces/ taking priority. Use takt eject to copy builtins to ~/.takt/ for customization.
Note (v0.4.0): Internal terminology has changed from "step" to "movement" for piece components. User-facing piece files remain compatible, but if you customize pieces, you may see
movements:instead ofsteps:in YAML files. The functionality remains the same.
Piece Example
name: default
max_iterations: 10
initial_movement: plan
movements:
- name: plan
agent: ../agents/default/planner.md
model: opus
edit: false
rules:
- condition: Planning complete
next: implement
instruction_template: |
Analyze the request and create an implementation plan.
- name: implement
agent: ../agents/default/coder.md
edit: true
permission_mode: edit
rules:
- condition: Implementation complete
next: review
- condition: Blocked
next: ABORT
instruction_template: |
Implement based on the plan.
- name: review
agent: ../agents/default/architecture-reviewer.md
edit: false
rules:
- condition: Approved
next: COMPLETE
- condition: Needs fix
next: implement
instruction_template: |
Review the implementation from architecture and code quality perspectives.Agentless Movements
The agent field is optional. When omitted, the movement executes using only the instruction_template without a system prompt. This is useful for simple tasks that don't require agent behavior customization.
- name: summarize
# No agent specified — uses instruction_template only
edit: false
rules:
- condition: Summary complete
next: COMPLETE
instruction_template: |
Read the report and provide a concise summary.You can also write an inline system prompt as the agent value (if the specified file doesn't exist):
- name: review
agent: "You are a code reviewer. Focus on readability and maintainability."
edit: false
instruction_template: |
Review code quality.Parallel Movements
Execute sub-movements in parallel within a movement and evaluate with aggregate conditions:
- name: reviewers
parallel:
- name: arch-review
agent: ../agents/default/architecture-reviewer.md
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
Review architecture and code quality.
- name: security-review
agent: ../agents/default/security-reviewer.md
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
Review for security vulnerabilities.
rules:
- condition: all("approved")
next: supervise
- condition: any("needs_fix")
next: fixall("X"): true if ALL sub-movements matched condition Xany("X"): true if ANY sub-movement matched condition X- Sub-movement
rulesdefine possible outcomes, butnextis optional (parent controls transition)
Rule Condition Types
| Type | Syntax | Description |
|------|--------|-------------|
| Tag-based | "condition text" | Agent outputs [MOVEMENTNAME:N] tag, matched by index |
| AI judge | ai("condition text") | AI evaluates condition against agent output |
| Aggregate | all("X") / any("X") | Aggregates parallel sub-movement matched conditions |
Builtin Pieces
TAKT includes multiple builtin pieces:
| Piece | Description |
|----------|-------------|
| default | Full development piece: plan → architecture design → implement → AI review → parallel review (architect + security) → supervisor approval. Includes fix loops at each review stage. |
| minimal | Quick piece: plan → implement → review → supervisor. Minimal steps for fast iteration. |
| review-fix-minimal | Review-focused piece: review → fix → supervisor. For iterative improvement based on review feedback. |
| research | Research piece: planner → digger → supervisor. Autonomously executes research without asking questions. |
| expert | Full-stack development piece: architecture, frontend, security, QA reviews with fix loops. |
| expert-cqrs | Full-stack development piece (CQRS+ES specialized): CQRS+ES, frontend, security, QA reviews with fix loops. |
| magi | Deliberation system inspired by Evangelion. Three AI personas (MELCHIOR, BALTHASAR, CASPER) analyze and vote. |
| review-only | Read-only code review piece that makes no changes. |
Use takt switch to switch pieces.
Builtin Agents
| Agent | Description | |-------|-------------| | planner | Task analysis, spec investigation, implementation planning | | coder | Feature implementation, bug fixing | | ai-antipattern-reviewer | AI-specific antipattern review (non-existent APIs, incorrect assumptions, scope creep) | | architecture-reviewer | Architecture and code quality review, spec compliance verification | | security-reviewer | Security vulnerability assessment | | supervisor | Final validation, approval |
Custom Agents
Create agent prompts in Markdown files:
# ~/.takt/agents/my-agents/reviewer.md
You are a code reviewer specialized in security.
## Role
- Check for security vulnerabilities
- Verify input validation
- Review authentication logicModel Selection
The model field (in piece movements, agent config, or global config) is passed directly to the provider (Claude Code CLI / Codex SDK). TAKT does not resolve model aliases.
Claude Code
Claude Code supports aliases (opus, sonnet, haiku, opusplan, default) and full model names (e.g., claude-sonnet-4-5-20250929). Refer to the Claude Code documentation for available models.
Codex
The model string is passed to the Codex SDK. If unspecified, defaults to codex. Refer to Codex documentation for available models.
Project Structure
~/.takt/ # Global configuration directory
├── config.yaml # Global config (provider, model, piece, etc.)
├── pieces/ # User piece definitions (override builtins)
│ └── custom.yaml
└── agents/ # User agent prompt files (.md)
└── my-agent.md
.takt/ # Project-level configuration
├── config.yaml # Project config (current piece, etc.)
├── tasks/ # Pending task files (.yaml, .md)
├── completed/ # Completed tasks and reports
├── reports/ # Execution reports (auto-generated)
│ └── {timestamp}-{slug}/
└── logs/ # NDJSON format session logs
├── latest.json # Pointer to current/latest session
├── previous.json # Pointer to previous session
└── {sessionId}.jsonl # NDJSON session log per piece executionBuiltin resources are embedded in the npm package (dist/resources/). User files in ~/.takt/ take priority.
Global Configuration
Configure default provider and model in ~/.takt/config.yaml:
# ~/.takt/config.yaml
language: en
default_piece: default
log_level: info
provider: claude # Default provider: claude or codex
model: sonnet # Default model (optional)
# API Key configuration (optional)
# Can be overridden by environment variables TAKT_ANTHROPIC_API_KEY / TAKT_OPENAI_API_KEY
anthropic_api_key: sk-ant-... # For Claude (Anthropic)
# openai_api_key: sk-... # For Codex (OpenAI)
trusted_directories:
- /path/to/trusted/dir
# Pipeline execution configuration (optional)
# Customize branch names, commit messages, and PR body.
# pipeline:
# default_branch_prefix: "takt/"
# commit_message_template: "feat: {title} (#{issue})"
# pr_body_template: |
# ## Summary
# {issue_body}
# Closes #{issue}API Key Configuration Methods:
Set via environment variables:
export TAKT_ANTHROPIC_API_KEY=sk-ant-... # For Claude # or export TAKT_OPENAI_API_KEY=sk-... # For CodexSet in config file: Write
anthropic_api_keyoropenai_api_keyin~/.takt/config.yamlas shown above
Priority: Environment variables > config.yaml settings
Notes:
- If you set an API Key, installing Claude Code or Codex is not necessary. TAKT directly calls the Anthropic API or OpenAI API.
- Security: If you write API Keys in
config.yaml, be careful not to commit this file to Git. Consider using environment variables or adding~/.takt/config.yamlto.gitignore.
Pipeline Template Variables:
| Variable | Available In | Description |
|----------|-------------|-------------|
| {title} | Commit message | Issue title |
| {issue} | Commit message, PR body | Issue number |
| {issue_body} | PR body | Issue body |
| {report} | PR body | Piece execution report |
Model Resolution Priority:
- Piece movement
model(highest priority) - Custom agent
model - Global config
model - Provider default (Claude: sonnet, Codex: codex)
Detailed Guides
Task File Formats
TAKT supports batch processing with task files in .takt/tasks/. Both .yaml/.yml and .md file formats are supported.
YAML format (recommended, supports worktree/branch/piece options):
# .takt/tasks/add-auth.yaml
task: "Add authentication feature"
worktree: true # Execute in isolated shared clone
branch: "feat/add-auth" # Branch name (auto-generated if omitted)
piece: "default" # Piece specification (uses current if omitted)Markdown format (simple, backward compatible):
# .takt/tasks/add-login-feature.md
Add login feature to the application.
Requirements:
- Username and password fields
- Form validation
- Error handling on failureIsolated Execution with Shared Clone
Specifying worktree in YAML task files executes each task in an isolated clone created with git clone --shared, keeping your main working directory clean:
worktree: true- Auto-create shared clone in adjacent directory (or location specified byworktree_dirconfig)worktree: "/path/to/dir"- Create at specified pathbranch: "feat/xxx"- Use specified branch (auto-generated astakt/{timestamp}-{slug}if omitted)- Omit
worktree- Execute in current directory (default)
Note: The YAML field name remains
worktreefor backward compatibility. Internally, it usesgit clone --sharedinstead ofgit worktree. Git worktrees have a.gitfile containinggitdir:pointing to the main repository, which Claude Code follows to recognize the main repository as the project root. Shared clones have an independent.gitdirectory, preventing this issue.
Clones are ephemeral. After task completion, they auto-commit + push, then delete the clone. Branches are the only persistent artifacts. Use takt list to list, merge, or delete branches.
Session Logs
TAKT writes session logs in NDJSON (.jsonl) format to .takt/logs/. Each record is atomically appended, so partial logs are preserved even if the process crashes, and you can track in real-time with tail -f.
.takt/logs/latest.json- Pointer to current (or latest) session.takt/logs/previous.json- Pointer to previous session.takt/logs/{sessionId}.jsonl- NDJSON session log per piece execution
Record types: piece_start, step_start, step_complete, piece_complete, piece_abort
Agents can read previous.json to inherit context from the previous execution. Session continuation is automatic — just run takt "task" to continue from the previous session.
Adding Custom Pieces
Add YAML files to ~/.takt/pieces/ or customize builtins with takt eject:
# Copy default piece to ~/.takt/pieces/ and edit
takt eject default# ~/.takt/pieces/my-piece.yaml
name: my-piece
description: Custom piece
max_iterations: 5
initial_movement: analyze
movements:
- name: analyze
agent: ~/.takt/agents/my-agents/analyzer.md
edit: false
rules:
- condition: Analysis complete
next: implement
instruction_template: |
Thoroughly analyze this request.
- name: implement
agent: ~/.takt/agents/default/coder.md
edit: true
permission_mode: edit
pass_previous_response: true
rules:
- condition: Complete
next: COMPLETE
instruction_template: |
Implement based on the analysis.Note:
{task},{previous_response},{user_inputs}are automatically injected into instructions. Explicit placeholders are only needed if you want to control their position in the template.
Specifying Agents by Path
In piece definitions, specify agents using file paths:
# Relative path from piece file
agent: ../agents/default/coder.md
# Home directory
agent: ~/.takt/agents/default/coder.md
# Absolute path
agent: /path/to/custom/agent.mdPiece Variables
Variables available in instruction_template:
| Variable | Description |
|----------|-------------|
| {task} | Original user request (auto-injected if not in template) |
| {iteration} | Piece-wide turn count (total steps executed) |
| {max_iterations} | Maximum iteration count |
| {movement_iteration} | Per-movement iteration count (times this movement has been executed) |
| {previous_response} | Output from previous movement (auto-injected if not in template) |
| {user_inputs} | Additional user inputs during piece (auto-injected if not in template) |
| {report_dir} | Report directory path (e.g., .takt/reports/20250126-143052-task-summary) |
| {report:filename} | Expands to {report_dir}/filename (e.g., {report:00-plan.md}) |
Piece Design
Elements needed for each piece movement:
1. Agent - Markdown file containing system prompt:
agent: ../agents/default/coder.md # Path to agent prompt file
agent_name: coder # Display name (optional)2. Rules - Define routing from movement to next movement. The instruction builder auto-injects status output rules, so agents know which tags to output:
rules:
- condition: "Implementation complete"
next: review
- condition: "Blocked"
next: ABORTSpecial next values: COMPLETE (success), ABORT (failure)
3. Movement Options:
| Option | Default | Description |
|--------|---------|-------------|
| edit | - | Whether movement can edit project files (true/false) |
| pass_previous_response | true | Pass previous movement output to {previous_response} |
| allowed_tools | - | List of tools agent can use (Read, Glob, Grep, Edit, Write, Bash, etc.) |
| provider | - | Override provider for this movement (claude or codex) |
| model | - | Override model for this movement |
| permission_mode | - | Permission mode: readonly, edit, full (provider-independent) |
| report | - | Auto-generated report file settings (name, format) |
API Usage Example
import { PieceEngine, loadPiece } from 'takt'; // npm install takt
const config = loadPiece('default');
if (!config) {
throw new Error('Piece not found');
}
const engine = new PieceEngine(config, process.cwd(), 'My task');
engine.on('step:complete', (step, response) => {
console.log(`${step.name}: ${response.status}`);
});
await engine.run();Contributing
See CONTRIBUTING.md for details.
CI/CD Integration
GitHub Actions
TAKT provides a GitHub Action for automating PR reviews and task execution. See takt-action for details.
Piece example (see .github/workflows/takt-action.yml in this repository):
name: TAKT
on:
issue_comment:
types: [created]
jobs:
takt:
if: contains(github.event.comment.body, '@takt')
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run TAKT
uses: nrslib/takt-action@main
with:
anthropic_api_key: ${{ secrets.TAKT_ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}Cost Warning: TAKT uses AI APIs (Claude or OpenAI), which can incur significant costs, especially when tasks are auto-executed in CI/CD environments. Monitor API usage and set up billing alerts.
Other CI Systems
For CI systems other than GitHub, use pipeline mode:
# Install takt
npm install -g takt
# Run in pipeline mode
takt --pipeline --task "Fix bug" --auto-pr --repo owner/repoFor authentication, set TAKT_ANTHROPIC_API_KEY or TAKT_OPENAI_API_KEY environment variables (TAKT-specific prefix).
# For Claude (Anthropic)
export TAKT_ANTHROPIC_API_KEY=sk-ant-...
# For Codex (OpenAI)
export TAKT_OPENAI_API_KEY=sk-...Documentation
- Piece Guide - Creating and customizing pieces
- Agent Guide - Configuring custom agents
- Changelog - Version history
- Security Policy - Vulnerability reporting
- Blog: TAKT - AI Agent Orchestration - Design philosophy and practical usage guide (Japanese)
License
MIT - See LICENSE for details.
