Tegoby Attention SpanBlogBook a demo

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.

  1. Install Tego. On Linux:

    Terminal
    curl -fsSL https://github.com/Attention-Span-AI/Tego/releases/latest/download/install.sh | sh

    On a Mac or Windows PC, follow Install, then run every step below inside the VM.

  2. Check your machine.

    Shell
    tego doctor

    Near the end it prints a line such as tier: landlock (the Basic level). Anything but tier: none means you're ready. If not, see Install.

  3. 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 in src, tests and .claude-state.

  4. 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 the pass: lines for ANTHROPIC_API_KEY, and add these under set:, 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.

  5. Run Claude Code under it.

    Shell
    export ANTHROPIC_API_KEY=<your key>
    tego run agent.yaml

    The task asks for NOTES.md in the project root, which is outside the folders the agent may write. Claude Code gets an ordinary Permission denied, and Tego records the refusal with its rule. The last line of tego run sums up the run: its id, the refusals and the files written.

  6. See the refusal and its record.

    Shell
    tego receipt --last

    The 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 --open

    It 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.