Tego quickstart
Updated
In a few steps you run Claude Code under rules enforced from outside it, watch Tego refuse one of its actions, and read the record of it.
You need Linux (or a small Linux VM on a Mac or Windows PC), Claude Code installed there, and an Anthropic API key.
Install Tego. On Linux:
Terminal curl -fsSL https://github.com/ | shAttention-Span-AI/ Tego/ releases/ latest/ download/ install.sh On a Mac or Windows PC, follow Install, then run every step below inside the VM.
Check your machine.
Shell tego doctorNear the end it prints a line such as
tier: landlock(the Basic level). Anything buttier: nonemeans you're ready. If not, see Install.Write the strict setup. In your project folder:
Terminal mkdir -p .claude-state/tmp tego init --preset no-secrets,no-prod,repo-only-writes --write src --write tests --write .claude-state \ --command 'claude -p --permission-mode acceptEdits "Write a one-line summary of this project to NOTES.md"'This writes
agent.yaml, this agent's contract: the file of rules Tego holds it to. Its three presets are built-in rule sets: the agent can't read your secret files or secret variables, reaches no host you didn't list, and writes only insrc,testsand.claude-state.Let Claude Code reach its model. Open
agent.yaml. Add the model at the top level:YAML models: - {provider: anthropic, host: api.anthropic.com, port: 443}Under
env:, uncomment thepass:lines forANTHROPIC_API_KEY, and add these underset:, so Claude Code keeps its state in the project and never writes~/.claude:YAML CLAUDE_CONFIG_DIR: ".claude-state" CLAUDE_CODE_TMPDIR: ".claude-state/tmp" CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1"Check the file with
tego compile agent.yaml. It prints what is allowed and refused, and runs nothing.Run Claude Code under it.
Shell export ANTHROPIC_API_KEY=<your key> tego run agent.yamlThe task asks for
NOTES.mdin the project root, which is outside the folders the agent may write. Claude Code gets an ordinaryPermission denied, and Tego records the refusal with its rule. The last line oftego runsums up the run: its id, the refusals and the files written.See the refusal and its record.
Shell tego receipt --lastThe receipt lists what the run did: files written, connections, programs run, and each refused action with the rule behind it, such as
write-outside-contract. For the same run in a browser, start the dashboard in a second terminal:Shell tego serve --openIt opens on
127.0.0.1:8484. Your run is under Runs, with its receipt and refusals.
Once this works, narrow the rules to what your agent really uses with tego learn, or switch to the full-screen claude with a ready contract.