Inspiration
We run a real company (Nokto) on agent-written code. Every agent demo ends the same way: impressive output, then a human quietly re-reading every line, because the trust is vibes-based. We wanted trust to be structural: contracts, isolation and independent review, so agents can ship real changes to real repositories.
What it does
NOKTO Agent Orchestrator turns a code change into a YAML task contract:
```yaml id: example-add-usage-docs goal: Add a short quick-start section to README.md scope: allowedPaths: ['README.md'] disallowedPaths: ['src/**'] acceptanceCriteria:
- README.md contains a quick-start section
- No other files are changed testRequirements: commands: ['pnpm run lint', 'pnpm run typecheck'] mustPass: true constraints: maxRetries: 1 ```
The orchestrator then drives a ten-step delivery pipeline:
- Claude plans with read-only access
- The plan passes static validation: scope, hard-blocked areas and secrets
- Work happens in an isolated git worktree. Agents never touch the main working copy
- Codex implements, with Claude as fallback
- Claude reviews only the diff, never the implementer's own summary
- A second model (Codex or Gemini) cross-reviews when Claude also wrote the code, or when the first review raised major findings
- The contract's test commands run through an explicit command allowlist
- Findings and failures return to the implementer as concrete correction items
- Re-review and re-verification, bounded by
maxRetries - The diff is scanned for secrets, and the change ships as a pull request with the complete report. A human merges, always.
Hard-blocked areas are paths no contract can open: .git/, .github/, CODEOWNERS, .husky/, .npmrc, .env files and config.json.
How we built it
TypeScript on Node 20 or newer. The claude and codex CLIs run as subprocesses with argument-based execution. There is no shell: true anywhere, so shell injection is prevented structurally. Gemini participates as a reviewer through the official Google GenAI SDK (gemini-3.5-flash by default), and a small public project endpoint runs on Google Cloud Run. Phases exchange strict JSON: model output that cannot be parsed is an error, never a guess. State is written atomically after every step, so an interrupted run resumes from the last completed step, and every event goes to an append-only JSONL audit log with secrets redacted.
The same seven operations are available from the CLI and from an MCP server over stdio, so another agent can drive the orchestrator directly.
Security is allowlists all the way down: binaries, git subcommands and paths. git reset, git clean, git filter-branch and git filter-repo are always blocked, and so are --force and --force-with-lease. nokto-agent doctor verifies the binaries that actually exist instead of assuming a provider is available.
Try it
bash
pnpm install
pnpm run build
nokto-agent doctor
nokto-agent run --task tasks/example.yaml
Challenges we ran into
Fail-closed is a discipline, not a feature. When the secondary reviewer's binary is missing, the run fails with a blocker instead of quietly skipping the check. Designing every failure path to stop rather than degrade took as much work as the happy path.
Model output is not an API. Reviewers return prose around their JSON, so every phase parses strictly and treats anything else as a failed step.
Scope has to be checked on the real diff, not on the plan. The scope guard inspects changed, deleted, renamed and untracked files, and every commit on its own, before review and before push.
Accomplishments that we're proud of
It runs in production at Nokto. The model that writes the code is never the only one that reviews it. Eleven security controls are listed in the README, runs are resumable, and every step is in the audit log: an agent pipeline you can show an auditor, not just a demo audience.
What we learned
An agentic pipeline is a supply chain: every hand-off between model and machine is an attack surface and a failure point. The controls belong in the structure (allowlists, isolation, atomic state), not in the prompt.
What's next
Gemini as an implementer, a remote transport for the MCP server, and parallel fan-out of independent tasks.
Built With
- claude-code
- cloud-run
- gemini
- git
- github
- mcp
- node.js
- openai-codex
- pnpm
- typescript
- vitest
- yaml
