Project contract
Every repository worked on with Taskgert follows one contract: a file at its root, taskgert.yml, says how the
project is built, tested and released, how far an agent may go alone, where it is deployed, and the steps a task
goes through. A person and an agent then work the same way in any repository, and Taskgert can check that the
project really works that way.
The file
# yaml-language-server: $schema=https://taskgert.com/schemas/taskgert.v1.json
version: 1
project: BOIL # the Taskgert project key
commands: # standard names; each maps to the repository's own command
install: pnpm install --frozen-lockfile
dev: pnpm dev
lint: pnpm lint
test: pnpm test
build: pnpm build
e2e:
seed: docker compose exec -T app node dist/seed.js
run: pnpm exec playwright test
git:
main: main
develop: develop
version: package.json # where the semver version lives
pr: gitea # gitea | github | gitlab | none
agent:
merge: none # none | develop | main — how far an agent goes alone
autonomy: supervised # supervised | staging | full — the most a job may be given (see Autonomy)
codegraph: true # false: the runner's jobs go without the code graph (CodeGraph)
environments:
staging:
url: https://trylive.taskgert.com
from: develop # what is deployed: a branch, or `tags` for release tags on main
deploy:
provider: coolify
compose: docker-compose.yml
app: z387bjco91ldml51mvczfkky
verify:
health: [https://trylive.taskgert.com/api/health]
production:
url: https://comidas.example.com
from: tags
deploy:
provider: coolify
compose: docker-compose.coolify.yml
app: <uuid>
after: ./scripts/publish-image.sh # optional: run once the deployment is verified
permissions:
network: [registry.npmjs.org] # hosts agents may reach without asking, besides the defaults
mcp: [playwright] # MCP servers the agents need, besides taskgert and the deploy provider's
phases: standard # or a list that extends or overrides the standard phases
- Only
version,projectandcommands.testare required.gitdefaults tomain,developand no PR host;agent.mergetonone;phasestostandard. - Unknown keys are an error, and so is an environment other than
stagingandproduction: every key is read by a command or a check, and nothing is kept "for later". - The JSON Schema is published at
/schemas/taskgert.v1.json. With the first line above, editors that use the YAML language server (VS Code's YAML extension, for one) complete and check the file as you type.
Commands
The names are always the same, whatever the stack: install, dev, lint, test, int, build, e2e and
release. Each maps to the repository's own command; int (optional) is the integration tests, when the repository
runs them apart from the unit tests. e2e is either one command or {prepare, seed, run}: the stack comes up from
docker-compose.yml, seed loads the test data, and run runs the tests against E2E_BASE_URL.
e2e as an object also takes, all optional:
| Key | What it is | Default |
|---|---|---|
prepare | builds host-side test prerequisites before startup/tests, including --against; receives the suite environment | none |
seed | loads the test data once the stack is up (docker compose exec -T app …) | none |
run | the tests, against E2E_BASE_URL | required |
profiles | compose profiles the stack needs, passed as COMPOSE_PROFILES | none |
service | the service the tests talk to: E2E_BASE_URL is its published port | app |
port | its container port | the first port it publishes |
timeout | seconds docker compose up --wait waits for every service to be healthy | 300 |
Preparation runs once inside tg e2e; failure prevents startup and tests. It does not install dependencies:
runner CHECK jobs run tg install first. With explicit prepare, they avoid the legacy full host tg build;
without it (including string-form E2E), that compatibility prebuild remains. Declare the host test dependency
closure rather than duplicating application builds which Compose already performs. The Code phase's full build
gate is unchanged.
Local E2E invocations use fresh, invocation-specific Compose projects and project-scoped volumes before seeding.
They do not reset an inherited developer/job stack. Teardown is attempted even after exceptions; --keep
intentionally retains the invocation stack. Ownership records enable exact runner job-end recovery of interrupted
stacks. Never use broad project-name-prefix deletion for recovery. External or explicitly globally named volumes
and persistent bind mounts are not isolated by fresh project names; do not use them for disposable test data.
--against never starts or removes a Compose stack.
agent.merge says how far an agent goes alone:
| Value | The agent… |
|---|---|
none | pushes agent/<KEY> and opens a pull request; a person merges. The default. |
develop | merges into develop itself. Releasing and deploying stay with a person. |
main | may also release. Deploying stays with a person. |
agent.autonomy is the ceiling of how far a job may take a change alone (see Autonomy):
supervised (the default), staging or full.
agent.codegraph (default true) gives the runner's jobs a code graph. Before the agent starts, the runner indexes
the worktree with CodeGraph, and the agent gets its MCP server,
codegraph, with the tool codegraph_explore. false turns it off for the project
(the code graph). The runner reads it from the job's own worktree, so a branch
that changes it applies to that branch's jobs. taskgert init adds the same server to .mcp.json for your own
sessions (see The kit).
docker-compose.yml
It is mandatory: the whole stack, used locally, by e2e, and deployed as is to staging (production deploys
docker-compose.coolify.yml, without its databases). The stack must run inside the runner's Docker-in-Docker,
so:
- every service has a healthcheck, so
docker compose up --waitmeans "ready"; - no host bind mounts (
./data:/data,/var/run/docker.sock:…): use named volumes; - no
container_name: two jobs run the stack side by side under different project names; - ports come from env vars with defaults (
${APP_PORT:-3000}:3000).
Phases
The phases are the steps of a task, each with how it is checked:
| Phase | Id | Checked by |
|---|---|---|
| Plan | plan | a person (ask_person) |
| Contract | contract | lint — optional: only if any |
| Code | code | build |
| Lint & test | lint-test | lint and test |
| E2E | e2e | e2e |
| Merge | merge | a person |
| Memory | memory | the agent's word (a note) |
| Release | release | release — optional |
| Deploy | deploy | a person — optional |
| Verify | verify | evidence (an attachment) — optional |
Memory comes right after Merge: the agent records what the whole project should remember from the task (a gotcha, a fix with a general lesson, a decision with its why), or notes there was nothing to save. Existing tasks keep their checklists; the sync adds the item to the template. While the project's memory is off for agents, the phase does not apply (a runner passes it with the note "memory off").
A command check passes when the command exits 0; an evidence check when an attachment proves it; a manual one when
a person reports it. With phases: standard, a phase whose command the file does not define is left out (no
e2e, no E2E phase).
A list is the whole order instead: a standard id keeps that phase, an object with a standard id changes it, and an
object with a new id adds one (it needs a title and a check):
phases:
- plan
- contract
- code
- lint-test
- id: catalog
title: MCP catalog and docs
check: { command: test } # or { evidence: true }, or { manual: true }
- e2e
- merge
- id: verify
optional: false # every task is verified
Sync
Taskgert reads the file from the head of the repository's default branch, with the repository's credential:
- on Sync in Settings → Repository & contract → Way of working, or with
get_contractandsync: true(editors and agents); - on its own when the repository or its credential changes;
- at the end of
tg release(oncemainand the tag are pushed) and oftg deploy(before it reports the outcome). Both ask through the Taskgert MCP, liketg usage. This is best effort: without a token, or if Taskgert does not answer, they only say so; - when the project checks run (Run checks,
check_project, a runner connecting, a job starting) and the head of the default branch is no longer the commit that was synced. The checks' ownls-remotegives that head, so any push is seen by the next check run.
It keeps the commit, the file, and either the parsed contract or its errors, each with its path and line
(line 6: agent.merge must be one of none, develop, main). A missing file is kept as missing.
When the contract is valid, its phases become the project's checklist template Phases, applied to every new task, with a hint on each check that says how it is checked. Edit the file, not the template: the next sync replaces it. Tasks already created keep their checklist. Other templates (applied on creation or not) are left alone.
Environments from the file
Each sync also fills the project's Environments card (Settings → Environments) from environments of the file,
one upsert per environment:
- an environment the file declares is created, or updated, with its
url,from,deploy.provider,deploy.compose,deploy.app(the Coolify application) andverify.health. It is marked from taskgert.yml @ <commit>; the file's fields win over what the card had, and are read-only in the card (change them in the file, push it and sync); - the credentials are never touched: the Coolify URL and the API token (encrypted, never shown again) are the only part a person adds, with Credentials on the environment. The file never holds a secret;
- an environment the file no longer declares is not deleted: it keeps its credentials and is marked no longer in taskgert.yml, for a person to delete (or to declare again). One the file still declares cannot be deleted: the next sync would bring it back;
- an invalid file leaves the environments as they are.
Every change is audited (project.environment-synced). get_contract shows the same for agents
(environmentsCard: where each environment comes from and whether its credentials are set, never them).
The Way of working card shows the last sync (the commit and when), whether the file is valid with every error,
and when it is: the commands, git, agent.merge, the environments, the phases, and the compose services with ✔ or
✖ for their healthcheck. Agents read the same with get_contract.
Checks
Each sync re-runs the project checks, which gain a Contract area:
| Check | ✖ / ⚠ when |
|---|---|
taskgert.yml present | ✖ it is not on the default branch |
taskgert.yml valid | ✖ it is not, with its first errors |
| Synced | ⚠ never synced; ✔ shows the commit |
docker-compose.yml present | ✖ missing, or not readable |
| Healthchecks | ✖ services without one, by name |
| Host bind mounts, container_name | ⚠ the services that have them |
| Each environment | ⚠ credentials missing (only the Coolify URL and token are left for a person); no longer in taskgert.yml; or only in the card |
| Its compose file | ⚠ the application deploys another compose file than deploy.compose says |
A failing contract does not stop agent jobs (only the repository and the runners do), but it says what the project is missing to be worked on the standard way.
Gitflow and pull requests
The classic git-flow, with one prefix for agents:
| Branch | What |
|---|---|
main (git.main) | release tags only |
develop (git.develop) | where work is merged (--no-ff, with lint, test and e2e green) |
feature/<KEY>-slug, fix/<KEY>-slug | people's work, from develop |
agent/<KEY> | an agent's work, from develop |
release/x.y.z, hotfix/x.y.z | made and removed by tg release |
Commits are Conventional Commits with a Refs: <KEY> footer.
tg release [x.y.z], from develop with a clean tree:
- the version: the one given, else a minor bump (
--patch,--major) of the version ingit.version(elsepackage.json, elsepyproject.toml); release.before, when the file sets it (release: { before: <command> }): run from the repository root ondevelopfor a step that may commit, such as bumping a dependency. It must leave the tree clean and on the same branch; a non-zero exit, a dirty tree or another branch stops the release (exit 2) before anything is made, and its commits go into the changelog.--dry-runonly prints it; a hotfix does not run it;release/x.y.zfromdevelop, the version written, aCHANGELOG.mdsection prepended from the Conventional Commits since the lastv*tag (Features, Fixes, Others; each entry with its scope, short hash and the keys of itsRefs:), committed aschore(release): x.y.z;- merged into
mainwith--no-ffand taggedvX.Y.Z(annotated, with the changelog section); - merged back into
develop, the release branch deleted; git push origin main develop --tags(--no-pushstops before it).
It refuses (exit 2) a dirty tree, being off develop, a missing version file, and main or develop diverged
from (or behind) origin; --dry-run prints the plan and what it would refuse, and changes nothing. A
commands.release in the file still wins over all this.
Hotfix: git checkout -b hotfix/x.y.z main, fix and commit, then tg release --hotfix: merged into main with
its tag (a patch bump unless the branch or the argument names the version), then into develop. Run from main it
makes the hotfix branch itself. When the hotfix does not merge cleanly into develop, main and the tag are done
and it says to merge that by hand.
agent.merge decides how far an agent goes alone, and with it what its runner asks a person for first (the
guarded actions sent with each job; deploying is always guarded):
agent.merge | The agent | Asks before |
|---|---|---|
none (default) | pushes agent/<KEY>; its runner opens the pull request | pushing to main or develop |
develop | merges into develop itself | pushing to main |
main | may also release with tg release | nothing of git |
Writing outside the worktree and the network stay as the project chose (Settings → Repository & contract), and
permissions.network adds hosts to the allowlist. Without a valid taskgert.yml, the project's choice is used as
it is (push-default-branch, the old name, guards whichever of main and develop is the default branch).
Pull requests (agent.merge: none and git.pr: gitea or github): when a job ends Done, its runner (not
the model) pushes agent/<KEY> if the agent did not and, when it has commits ahead of develop, opens a pull
request into develop (or finds the one already open), titled <KEY> <task title>, with the agent's last message
and the task's link as its description. The link is on the job (its console, the task's jobs, get_agent_job) and
in a comment on the task. It needs, in Settings → Repository & contract:
- API token for pull requests, stored encrypted and handed to the runner only for a job. Gitea: an access
token with
write:repository. GitHub: a fine-grained token with Pull requests read and write and Contents read. Without one, the runner commentsPush done; open the pull request by hand: <compare link>. A project admin can copy it from another project they administer whose token is for the same API (scheme, host and port): it is opened and sealed again on the server, never shown, and the copy is audited with its source. - Host API for pull requests, when it is not at the repository URL's host: by default
https://api.github.comfor github.com,https://<host>/api/v3for GitHub Enterprise andhttps://<host>/api/v1for Gitea. A Gitea whose SSH goes through its own host name (giteassh.example.combehind Cloudflare) needs its web host here (https://gitea.example.com/api/v1).
git.pr: gitlab gets the compare link only. The project checks prove it: Pull requests: the host API answers with
the token (✔, ✖ when it refuses the token; ⚠ without a token; skipped when git.pr is none or agent.merge is
not none). Unlike the other repository checks, it does not stop jobs.
The kit: tg, taskgert init/new
The kit (@taskgert/kit, bundled in the runner's image) gives every repository the same commands and the same
agent setup.
tg <command> finds taskgert.yml in the directory or a parent, runs the command it maps, with the shell in the
repository root, and ends with a timed summary (✔ tg test · 4.2s, ✖ tg test · exit 1 · 12.0s; NO_COLOR turns
the colour off). It exits with the command's own code, or 2 when the file is missing or invalid (its errors are
printed with their lines) or the command is not mapped.
| Command | Runs |
|---|---|
tg install, dev, lint, test, int, build | the mapped command |
tg e2e | the stack up, e2e.seed (when set), e2e.run, the evidence, the stack down (below) |
tg release [x.y.z] | the gitflow release (below), or commands.release when mapped |
tg deploy <env> | the deploy lifecycle through the environment's provider (below, "Deploy") |
tg usage mark|show | what agent sessions used on a task (below, "Session usage"); needs no taskgert.yml |
tg --validate | checks the file and prints the commands and phases |
tg <command> --json | also prints {command, run, exitCode, durationMs, startedAt} as the last line: the proof of a phase |
tg <check> --report [--task KEY] | a check with a standard report and a compact answer, posted to the task (below, "Quality reports") |
tg <check> --remote [--runner NAME] | the same check on the fastest free runner, for the pushed HEAD (below, "Checks on a runner") |
tg e2e --suite NAME | the e2e with a suite's env and args (quality.suites, below) |
tg quality wait <run id> | waits for a run on a runner to end, without polling, and prints its compact answer |
tg e2e runs the end-to-end tests on the whole stack, the same on a laptop and inside a runner job:
- Preflight, or exit 2:
docker compose versionworks,docker-compose.ymlexists, every service has a healthcheck ("service X has no healthcheck:up --waitcannot know it is ready"),e2e.serviceexists and publishes a port. e2e.prepare, when declared, thendocker compose up -d --build --wait --wait-timeout <e2e.timeout>, as its own fresh invocation project: a sanitized base from job id or directory, plus a unique E2E suffix. The inherited project's containers and volumes are not reused or reset. The developer's own stack (the file's default project) is never touched. Every host port the file reads from a variable (${API_PORT:-4000}:4000) gets a free port unless the shell sets it, so the two stacks never clash, and compose does not read.env(COMPOSE_DISABLE_ENV_FILE=1): the stack runs with the file's defaults and what the shell exports, as in the runner, where there is no.env.e2e.seed, thene2e.run, withE2E_BASE_URL=http://<host>:<published port>(fromdocker compose port; anE2E_BASE_URLalready set wins) andE2E_HOST:localhost, or the Docker host ofDOCKER_HOST=tcp://<name>:…(dockerinside the runner, the Docker-in-Docker sidecar). Both commands also seeCOMPOSE_PROJECT_NAME,COMPOSE_FILEandCOMPOSE_PROFILES, so a plaindocker compose port api 4000in them reaches this stack. A compose file can useE2E_HOSTand the port variables for URLs browsers need (http://${E2E_HOST:-localhost}:${API_PORT:-4000}). Each has a time limit:seed10 minutes,run2 hours (TG_E2E_SEED_TIMEOUT/TG_E2E_RUN_TIMEOUT, in seconds). Past it the step is stopped, named (the seed did not finish within 10 min), and the run fails as usual, stack down: a seed that threw but kept its process alive no longer holdstg e2efor hours.- Evidence in
.taskgert/out/e2e-<time>/:run.log(the output ofseedandrun),compose.log(every service's logs: on failure, and with--logson success), and copies of theplaywright-report/,test-results/(videos, screenshots, traces) andjunit*.xmlthe run wrote anywhere in the repository. - Attempt
docker compose down -v --rmi local --remove-orphansin exception-safe cleanup, also on failure, Ctrl-C or graceful SIGTERM;--keepleaves the stack up.--rmi localremoves the images the run built (every run is a fresh project, so they would pile up); pulled images stay. Validated ownership records support runner recovery after forced stops. - After a clean teardown, cap the Docker build cache with
docker builder prune -f --max-used-space 20GB, so rebuilds stay fast without filling the disk.TG_E2E_BUILD_CACHE_MAXsets another size (8GB),offdisables it; a failed prune only warns.
The summary line and the --json line end with the evidence: ✔ tg e2e · 3m12s · evidence: .taskgert/out/e2e-….
tg e2e --against <url> starts no stack: it runs e2e.prepare when declared, then e2e.run with
E2E_BASE_URL=<url>; with --smoke also
E2E_SMOKE=1. A Playwright config runs only the read-only tests tagged @smoke when it is set:
grep: process.env.E2E_SMOKE ? /@smoke/ : undefined. The deploy's verify step runs tg e2e --against <url> --smoke.
Quality reports
A check's whole output costs an agent thousands of tokens and says little: a passing tg e2e prints about 58 KB, of
which 72 % is docker compose up --build, and the last lines of a failing one are the stack going down.
tg lint|test|int|build|e2e --report (or TG_REPORT=1) keeps the output out of the terminal:
-
Everything the command prints goes to
.taskgert/out/<kind>-<time>/run.log(fortg e2ealso the stack going up and down; its evidence lands in the same directory). A dot every 30 seconds says it still runs. -
report.json(schema 1, the API'sQualityReport): the suites with their counts, each failure withfile:line, the test, the message (≤ 2 KB) and a snippet (≤ 20 lines), its artifacts (screenshots, traces), the flaky tests, and, when nothing could be parsed, an excerpt of the output's error lines with their context (≤ 4 KB). The kit reads the junit XML files the run wrote anywhere in the repository (vitest, pytest, go, jest, surefire), Playwright's JSON report (test-results/results.json), tsc's and eslint's diagnostics (turbo'spkg:task:prefixes taken apart), and marks a suite turbo replayed from its cache. Values of environment variables named*TOKEN*,*SECRET*,*PASSWORD*or*_KEYare redacted fromrun.logand the report. -
The terminal gets a compact answer: one line per suite worth reading, one block per failure, and the summary:
✖ pkg/src/cart.test.ts:12:21 — cart > totals the prices expected 30 to be 31 // Object.is equality │ ❯ src/cart.test.ts:12:21 ✖ tg test · 1 passed, 1 failed · exit 1 · 4.2s · run 0199… · report .taskgert/out/test-…/report.json Attempt 1 of 3 failed on ABC-12: fix the failures and run tg test again.On a pass it is one line:
✔ tg e2e · 92 passed, 1 flaky · 12m40s · report ….--jsonaddsreport,statusandsummary(the counts).
--task KEY (implies --report) records the run on the task before printing: the kit uploads
up to 5 failure screenshots and, for a failure the report cannot explain, a short diagnostic excerpt (10 MB in all) as
the task's files, and calls report_quality_run (with the whole report, no report.json file, and machine, the
short host name) through the session's Taskgert MCP, with the same server and token as tg usage (below).
The answer then carries the run's id and its attempt: 1 + the failed runs of that check on the task since its
last pass. A pass with only flaky tests (Playwright retries a test once under tg e2e, and one that passes on its
retry is flaky) resets the count; a run that could not start (ERROR: refused, the stack did not come up) is no
attempt. After the 3rd failed attempt the agent stops and asks a person (ask_person). get_quality_run shows
a run's failures compactly, list_quality_runs a project's or a task's runs, and get_task the latest run of each
kind. get_quality_insights (and the Quality tab) derive from the runs what to improve: see the workflows page. The runner's jobs run their checks with --report too: the agent is told the report's failures, and the run
is recorded with where: runner.
Checks on a runner
A runner can run a check for you (TSKGT-151): the developer's or the agent's machine may be slower than a runner's,
and a check on a runner costs no model tokens (a CHECK job has no agent session). tg <check> --remote (or
run_quality on the MCP) queues it for the pushed HEAD: a commit origin does not have is refused with the push
that fixes it (git push -u origin <branch>), since a runner only fetches what was pushed. The runner is the one
named (--runner NAME), else the task's setting (below), else the fastest free online runner of the project:
the lowest median duration of its last 5 passing runs of that kind (list_runners shows them with its CPUs and
memory), ties to the least busy, runners never measured after the measured ones. With no runner online it says so
and suggests --local; it never waits forever.
The runner checks the commit out detached in a worktree of its own, runs tg <check> --report --local (with the
suite) under the job's compose project, and reports the run with where: runner: QUEUED, then RUNNING with its
progress, then PASSED, FAILED or ERROR, with the same 3-attempt rule per task and kind. tg <check> --remote
waits for the end itself; tg quality wait <run id> (or get_quality_run with waitSeconds) waits for one already
queued. Each wait is answered at the run's next change, from its realtime event: no polling, and run in the
background the agent is woken once, when it ends.
Where checks run, and e2e suites
quality:
e2e: local # local | remote | auto
suites: # optional: each is extra env and args for the same commands.e2e
quick: { env: { E2E_OFFICE: '0' } }
full: { env: { E2E_OFFICE: '1' } }
smoke: { env: { E2E_SMOKE: '1' } }
Where tg e2e runs without --local or --remote is one setting, resolved field by field from the most specific
level that sets it: the task (its Quality card), its open Taskgert (its settings), the project
(Settings → Quality), then quality.e2e of taskgert.yml, else local. auto is a runner when one is measured
faster than this machine's last passing local runs of that kind, else here. The same levels can name a preferred
runner and a suite. get_task shows the effective value and the level it comes from (e2e: remote (from TGT-G4)),
and get_quality_settings the same for a task, a Taskgert or a project. Inside a runner's job tg e2e always runs
there.
tg e2e --suite full runs the same e2e command with the suite's env and args (appended to the tests command);
an unknown suite is refused with the list. Without a suite the e2e keeps its default scope (the office specs run only
when what the office is drawn from changed since the last release). The suite is written into the report and shown
in the Quality tab, so runs compare like with like.
The Quality tab
Each project has a Quality tab: the key numbers of the last 14 days (the latest status of each kind, the pass
rate, the median time per kind, the tasks failing now, the flaky tests, and how many runs were local or on runners
with the fastest runner), the runs with filters (kind, status, where, suite, task) that follow new runs live, and a
run's detail with its failures first (file:line, the test, the message and the code around it, each with a copy
button), its flaky tests, suites and files: a drawer on wide screens, its own page on a phone. The runs are grouped by
Task (default) or by Taskgert (a toggle remembered in the browser): each group shows its key and title (linking
to it), the latest status of each kind with its attempt, and expands to its runs. A local run shows the name of the
machine it ran on (julian-mac; "local" for runs reported before it was recorded), a runner run its runner. The commit
and the branch link to the repository's web page (GitHub, GitLab, Gitea and Bitbucket); when the SSH host is not the web
host, set the repository's Web URL in Settings → Repository. The files of a run show inside it, not among the
task's files. The task page has a Quality card with the latest run of each kind and where its checks run.
For the report to say more than an excerpt, the test tools write junit: vitest
reporters: ['default', ['junit', { outputFile: 'test-results/junit.xml' }]] (keep test-results/junit.xml in
turbo's outputs for test, so cached packages restore it), and Playwright ['json', { outputFile: 'test-results/results.json' }] with retries: 1 under the stack.
Inside a runner job the engine's environment has TG_JOB_ID and COMPOSE_PROJECT_NAME=tg-<job id> for manual
docker compose commands. tg e2e creates a fresh invocation project instead, and propagates that name to its
seed and test commands. When the job ends, the runner cleans its manual stack and validated ownership records
for interrupted E2E invocations. Intentionally retained --keep stacks are distinguished from crash leftovers.
taskgert init adds the kit to the repository in the current directory. It detects the stack (pnpm, npm or yarn
from the lockfile, Python with uv, Go, or generic) to prefill the commands, asks for the project key (or takes
--project KEY --yes), and writes:
- Written once, then the repository's own:
taskgert.yml, a starterdocker-compose.yml(only when there is none),commitlint.config.jsandCHANGELOG.md(when missing). - Managed (refreshed while nobody edits them): the skills
taskgert-task,taskgert-runandtaskgert-deployin.claude/skills/; the subagentsplanner,implementer,reviewer(read-only) andverifierin.claude/agents/; the pull request template ofgit.pr; Claude Code's status line and session hooks in.claude/taskgert/and OpenCode's plugin.opencode/plugin/taskgert-usage.ts(below, "Session usage"). - Merged: the MCP servers, into the repository's own config, its other servers kept:
.mcp.json(Claude Code:taskgertwithTASKGERT_MCP_TOKEN,playwright, those ofmcp:, andcodegraphunlessagent.codegraphisfalse) andopencode.json(OpenCode v2,mcp.servers: the same servers, the token as{env:TASKGERT_MCP_TOKEN}; a repository withopencode.jsoncadds them there itself)..claude/settings.jsongets the kit's permission rules:tgand git's read-only commands allowed, pushes tomainanddevelopdenied unlessagent.mergeallows them,tg deployasked; and itsstatusLine(unless the repository has one of its own) andhooksbeside the repository's own. - Fenced: in
CLAUDE.md,AGENTS.mdand.gitignore, only the block betweentaskgert:startandtaskgert:end. The.gitignoreblock ignores.taskgert/out/. - Seeded:
.codegraph/.gitignore, CodeGraph's own (everything in.codegraph/but itself stays out of git): it is committed, the index never is.
CodeGraph for your own sessions. The codegraph server in .mcp.json needs the CLI and an index. With the CLI
installed, taskgert init (and --update) indexes the repository itself (codegraph init) when it has no index yet;
without it, it tells you how to install it (it installs nothing):
- install the version the runner pins:
npm i -g @colbymchenry/[email protected]; - index the repository once:
codegraph init. The index then keeps itself in sync while an agent uses it.
To configure every agent on your machine instead, run codegraph install, CodeGraph's own installer.
The kit records what it wrote in .taskgert/kit.json, so taskgert init --update refreshes only its own files
and blocks, keeps (and reports) any it finds edited, and changes nothing on a second run. taskgert new <dir>
clones the reference repository (--from <git url>, or TASKGERT_TEMPLATE), drops its history, sets the project
key in taskgert.yml and runs init --update.
The skills and subagents are generic: every step runs tg <command> and reads taskgert.yml (get_contract); what
is specific to a repository goes in the unmanaged part of its CLAUDE.md. The runner adds the kit's agent files to a
job's worktree when the repository has a taskgert.yml but not them, without committing them.
Session usage: status line and hooks
The kit tells Taskgert what each agent session uses on the task it works on (TSKGT-148,
Session usage), and shows it as you work. taskgert init --update installs it:
-
The status line (
.claude/taskgert/statusline.mjs; Claude Code's terminal and desktop app, not the IDE extensions), in the Oh My Zsh robbyrussell style, then the model, the Taskgert task in progress, the context used and the session's tokens:➜ taskgert git:(develop) ✗ Opus 5.5 · TSKGT-150 · 42% ctx · 310k tokIt never calls the network: it saves the numbers it gets (no paths, no text) in
~/.taskgert/sessions/, for the hooks, and prints the line. -
The hooks (
.claude/taskgert/hooks.mjs, one script forSessionStart,PreToolUse,PostToolUse,SubagentStopandSessionEnd) follow the session's task from the taskgert MCP calls —claim_next_task,move_taskinto an active column or to done,release_task, andget_taskof a task in progress when it has none — and send few marks: one start, with the context already loaded at that moment, and one end (the task done or released, or the session closed), a compaction (SessionStartcompact) or a session taking over the open task (startup,clear,resume) only when one happens, and one mark per subagent this session launched with the Agent tool, once, when it ends (its type, model, tokens, time, background or worktree; never its prompt). Claude Code's own helpers, which also fireSubagentStop, are ignored. A task worked in one session sends about 2 to 4 marks. The counters come from the session's transcript (all of the input, cache reads and writes included, and the cost from the model's price when the status line gives none), else from the status line; the context and the status line's own cost still come from it. A background subagent is reported from its transcript when it stops, or when the session ends; a subagent's model is its transcript's, else the Agent call'smodel(haiku,sonnet… become the model ids they stand for). The hooks always exit 0, print nothing and send in the background: they never hold Claude Code up. They are off inside a runner job (the runner marks its own) and withTASKGERT_USAGE=off. -
OpenCode:
.opencode/plugin/taskgert-usage.tsdoes the same from OpenCode's events — its messages' tokens and model,session.compacted, the taskgert MCP tools, and a subagent per child session of itstasktool.
Both send with tg usage mark - (the mark as JSON on stdin), which calls the MCP's report_session_usage with
the server and bot token the taskgert MCP is registered with — in ~/.claude.json for the project or globally, or
in the project's .mcp.json — unless TASKGERT_MCP_URL and TASKGERT_MCP_TOKEN (or TASKGERT_TOKEN, as an
OpenCode setup exports it) say otherwise; TASKGERT_MCP_SERVER names another registration, such as
taskgert-local. The token is never printed, logged or written to the session files. tg usage show [TASK]
prints a task's session usage, per model and with its subagents; without a task, this machine's sessions as the
status line last saw them.
What taskgert init --update merges into .claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/taskgert/statusline.mjs\"",
"padding": 0
},
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/taskgert/hooks.mjs\"",
"timeout": 5
}
]
}
],
"PreToolUse": [{ "matcher": "mcp__taskgert.*__release_task|Agent|Task", "hooks": [{ "…": "the same" }] }],
"PostToolUse": [{ "matcher": "mcp__taskgert.*|Agent|Task", "hooks": [{ "…": "the same" }] }],
"SubagentStop": [{ "hooks": [{ "…": "the same" }] }],
"Stop": [{ "hooks": [{ "…": "the same" }] }],
"SessionEnd": [{ "hooks": [{ "…": "the same" }] }]
}
}
Autonomy
How far an agent takes a change alone is chosen per job (Run with agent, start_agent_job) or per Taskgert (its
start, create_taskgert/start_taskgert; its jobs take its level), up to the ceiling agent.autonomy of
taskgert.yml:
| Level | The job… |
|---|---|
supervised (default) | works as described above: guarded actions ask a person, agent.merge applies, releasing and deploying stay with a person, repeated failures ask a person. |
staging | works the whole flow alone up to staging: merges into develop, releases, deploys to staging and verifies. Production asks a person. |
full | works the whole flow alone to the end: every environment the contract declares, in order (staging, then production; production alone when it is the only one). |
What staging and full do without asking (the runner does it, not the model):
- Pre-flight: before Merge, every environment the job reaches must have its credentials, and the worktree's
taskgert.ymlmust deploy each one to the application (deploy.app) and compose file of the contract synced from the default branch, with the samecommands.release; otherwise the job ends Failed before develop or main move. - Merge: once the phases before it pass (
tg lint,tg test,tg e2e), the branch goes intodevelopwith--no-ffanddevelopis pushed; withgit.prset, the job's pull request is opened and merged through the host API (Gitea, GitHub). Only a branch that already holdsorigin/developis merged, so what lands is what was checked: otherwise the agent mergesdevelopin and the command checks before Merge run again. A conflict goes back to the agent, to mergedevelopinto its branch first. - Release:
tg releasefromdevelopas origin has it, a minor bump when afeatwent in since the last release tag and a patch otherwise. A project's owncommands.releaseruns only when it is the one of the synced contract. It runs in a private clone (the runner's own branches never move), one release of a repository at a time, and never twice for a job. Nothing since the last release: nothing to release. Astagingjob of a contract without a staging environment does not release (production may followmainor its tags): releasing and deploying stay with a person. - Deploy:
tg deploy <env> --tasks <KEY>for each environment the level reaches, in order, with that environment's credentials (below).tg deployverifies and rolls back by itself; a failed one ends the job Failed, and it never goes on to a later environment. Each deployment is reported (its people are told), and commented on the task. - Verify: the agent verifies the last environment reached (the phase's own check: evidence when it asks for it).
- Decisions: the non-critical ones are settled with the recommended option, said in a comment; critical ones still ask.
- Repeated failures: no person is asked whether the agent keeps trying: it keeps trying up to six failed checks of a phase, then the job ends Failed.
- Guarded actions: writing outside the worktree and reaching other hosts go ahead (said in the job's output).
Pushing to
developormain(the runner merges and releases itself), a force push,--all/--mirror, an MCP deploy tool, anything the repository's.claude/settings.jsonpermissions.denylists, and deploying anywhere the level does not reach (tg deploy productionof astagingjob) still ask a person. A Claude agent's own deploy goes ahead only as a command that is exactlytg deploy <env>with--json,--tasks,--versionor--dry-run(no other command, separator, pipe, substitution, redirection or assignment on the line), to an environment the level reaches whose application the synced contract names; it runs with that environment's provider credentials only, never the runner's Taskgert token (the runner's own Deploy phase reports the deployment). OpenCode directtg deploycommands are refused; its autonomous runner-owned Deploy phase remains available.
Agents working with you (Claude Code or OpenCode with the kit's skills, outside a runner) take the ceiling as
their level (TSKGT-275): at supervised releasing and deploying wait for you, batched; at staging or full,
once a task is merged with its checks green, the agent releases it with tg release and deploys it with
tg deploy <env> --tasks <KEY> to the environments the level reaches, in order, then verifies it — inside a
Taskgert, once at the end of the run. taskgert init writes the same into the CLAUDE.md block and the
.claude/settings.json permissions: tg deploy asks you at supervised, only tg deploy production at
staging, nothing at full. A deployment still needs its environment's credentials, verifies, rolls back on a
failed verify and stops there.
Where the ceiling comes from. agent.autonomy and the deploy targets are read from the contract synced from
the repository's default branch. For autonomy, make that branch main: then a change to the contract takes
effect only through a release a person (or an approved flow) makes, never through what an agent merges into
develop. The project checks warn (Autonomy read from the develop branch) when the ceiling is above
supervised and the default branch is git.develop.
Choosing staging or full needs the agent.autonomy permission (project admins and owners; a bot with that
role and the agents:autonomy scope, which no default token nor a runner's own carries), and is audited. Above the ceiling the API answers 422 autonomy-above-ceiling, with
the ceiling and how to raise it; without a valid synced taskgert.yml the ceiling is supervised. A job is never
given more than the ceiling as it stands when it is sent to its runner. Deploy credentials of the environments
an autonomous job reaches come in its assignment (built anew each time it is sent, never stored, each delivery
audited as project.environment-credential-delivered), are masked in its output and never written to its job file;
an environment without them in the Environments card fails the job at its deploy, saying so.
The project checks show the ceiling (Autonomy up to staging/full) and warn when it is full and
environments.production has no verify.health: an unattended production deploy needs a verify. tg --validate
says the same.
Deploy
tg deploy <env> deploys environments.<env> of taskgert.yml through its provider, coolify for now (another
provider exits 2: "provider X is not supported yet"). Every deployment follows the same lifecycle:
- check (exit 2 when it refuses, nothing deployed): the Coolify API answers with the token; the app
(
deploy.app) exists; it builds the branch offrom(git.mainfortags) anddeploy.compose(a warning when not); no deployment of the app is queued or running. What goes out is resolved onoriginwithgit ls-remote: forfrom: tagsthe newestvX.Y.Ztag (or--version vX.Y.Z), forfrom: <branch>its head. - deploy: that commit. Coolify deploys an app's branch, or the commit in its
git_commit_sha:tg deploypins the commit there, queues a deployment (POST /api/v1/deploy) and sets the pin back afterwards, so Coolify's own redeploys keep following the branch. A token withoutwritecannot pin: the branch head goes out, only when it is the commit wanted. - wait for the deployment (
--timeout, 15 minutes by default), printing its status; on failure, the last 40 lines of its log. - verify: every
verify.healthURL answers 2xx (retried for 2 minutes: Coolify can answer 404 for a short while after a deployment), thentg e2e --against <url> --smokewhen the contract mapse2e(--no-smokeskips it). - rollback, when verify fails (
--no-rollbackskips it): a redeploy of the previous successful deployment's commit, then its health checked again. An app with Coolify's "Shallow clone" on may not check out a commit behind its branch head:tg deploywarns about it. - after, only when verified (never after a rollback):
deploy.after, a shell command run in the repository, for what the release carries besides the app (an image the project's runners or clients pull, a package). It getsTG_DEPLOY_VERSION(the tag, or<branch>@<sha>),TG_DEPLOY_COMMITandTG_DEPLOY_ENVIRONMENT, never the deploy credentials. A failing one is warned about and noted in the report, but the deployment stands (exit 0): run it again by hand. - report: with
TASKGERT_URLandTASKGERT_TOKEN(a token withtasks:write), the deployment is reported to Taskgert,STARTEDand thenSUCCEEDEDorFAILED, with the version (the tag, or<branch>@<sha>), the environment, its URL, the tasks of--tasks KEY,KEY, notes (what failed, the rollback) androlledBack. Without them it says "not reported to Taskgert".
It exits 0 when deployed and verified, 1 when the deployment or its verification failed (rolled back or not), 2
when it refused. --dry-run runs the check and prints the plan; --json ends with
{command, run, exitCode, durationMs, startedAt, deployment, version, verified, rolledBack}.
Credentials. tg deploy reads TG_COOLIFY_URL and TG_COOLIFY_TOKEN from its environment only, never from a
file, and never prints them (they are masked in every error). A person sets them in their shell. An agent never
holds them: running tg deploy is a guarded action (deploy) that waits for a person, and the request shows what
goes where ("Deploy v1.4.0 to production (https://…)"). Once approved, the runner asks Taskgert for that
environment's credentials (the Coolify URL and the token sealed in the project's Environments card) over its
socket: only for an approved tg deploy of an open job on that runner, once per approval, each delivery audited
(project.environment-credential-delivered). They go to a file in the job's tmpfs that the command sources and
removes before it runs, with TASKGERT_URL and the runner's token so it reports itself; the token is masked in the
job's output. Only Claude agent-issued commands support this credential rewrite. OpenCode direct commands are
refused without credential lookup; autonomous runner-owned Deploy works independently of the chosen engine.