Skip to main content

tars-agent

TARS — a disciplined, multi-session coding agent loop

Why it exists

Named for TARS - the robot from Interstellar - whose worth lies not in cleverness but in discipline: it does what it said, reports honestly what it did, and asks before it touches anything. This tool tries to earn that name.

Install

pip install -e ".[dev]"

Or install the published package:

pipx install tars-agent
pip install tars-agent

Requires Python >=3.10.

This project has no runtime dependencies.

Quick Start

Get TARS running in 60 seconds:

pipx install tars-agent
# or: pip install tars-agent
tars setup
tars

Inside the REPL, just type what you want — bare prompts run the full ORIENT → CLASSIFY → PLAN → ACT → VERIFY → REFLECT → REPORT loop:

◐ tars › Fix the failing test in tests/test_login.py
◐ tars › Add dark mode to src/App.tsx and verify with tests
◐ tars › Explain how tars/memory scores candidates

Slash commands force a single phase:

Command What it does
tars setup Configure and live-validate provider credentials
/run <task> Full loop for one task
/route <task> Show tier/blast/reversibility without acting
/verify Run the repo's gate locally (tars-verify)
/memory [approve <id> | correct <id> "reason"] Review or correct remembered decisions
/status Model, tier, session, last verdict
/undo Restore the pre-ACT Git checkpoint
/resume [ID] Resume a prior session (survives Ctrl-C)
/pillars Show the seven-phase loop

One-shot (no REPL):

tars run "Fix bug in app.py --yes"
tars route "Add a new CLI flag"

Configure the cheapest model for simple tasks:

export TARS_TIER0_MODEL=openrouter:minimax/minimax-m3:free
# tier 0 (scaffold/create-artifact) uses this; tiers 1-2 stay on the flagship

Browser testing (optional):

pip install "tars-agent[browser]"
tars run "Check https://example.com loads and has a login button" --web-url https://example.com --web-expect "login"

How to run it

tars

Run TARS's disciplined agent loop.

tars
python -m tars.loop

Flags: --version, --yes, --root, --model, --web-url, --web-steps, --web-expect

declared in pyproject.toml

tars-browser

Efficient accessibility-tree-first web testing.

tars-browser
python -m tars.browser

declared in pyproject.toml

tars-memory

Read a session transcript and propose the memory entries it earned: domain-tagged, scored, and quoted from the turn they came from. Also reads back what earlier sessions kept.

tars-memory
python -m tars.memory

Flags: --write, --session, --max, --now, --domain, --kind, --limit, --root, --json, --no-color

declared in pyproject.toml

tars-readme

Write a README from what a repo actually contains: usage examples lifted from its own docstrings and tests, the commands it declares, and the checks it can run.

tars-readme
python -m tars.readme

Flags: -o/--output, --force, --check, --json, --include-unverified, --notes, --no-tests, --max-examples, --no-color

declared in pyproject.toml

tars-verify

Detect a repo's test runner, linter, type-checker and formatter, then run them uniformly.

tars-verify
python -m tars.verification

Flags: --only, --include, --list, --json, --fail-fast, --timeout, --output-lines, --max-output-chars, --allow-no-checks, --quiet/-q, --no-color

declared in pyproject.toml

python -m tars

Efficient accessibility-tree-first web testing.

python -m tars

declared in tars/__main__.py

Examples

Every snippet below was taken from the file named under it, and checked against the current source.

from tars.act import Edit, Hunk, LocalExecutor

executor = LocalExecutor(".")
result = executor.apply(Edit.replace("a.py", Hunk("x = 1", "x = 2")))
result.ok, result.diff, result.touched

tars/act/__init__.py:5

from tars.act import Command, LocalExecutor

LocalExecutor(".").run(Command(["pytest", "-q"])).reason

tars/act/__init__.py:24

from tars.act import Edit, Hunk, LocalExecutor

preview = LocalExecutor(".", dry_run=True)
preview.apply(Edit.replace("a.py", Hunk("x = 1", "x = 2"))).diff

tars/act/__init__.py:40

from tars.act import get_executor, known_executors

get_executor("local")
known_executors()

tars/act/__init__.py:48

from tars.memory import reflect_on

report = reflect_on("run/session.jsonl")
report.summary_line()
report.to_commit    # high-confidence, decision-shaped, domain-tagged
report.to_review    # what a human should see before anything believes it
report.dropped      # considered, scored too low, kept so you can see it

tars/memory/__init__.py:7

from tars.memory import reflect_on

reflect_on("run/session.jsonl").nothing_worth_remembering

tars/memory/__init__.py:22

How it's structured

  • tars/__init__.py — TARS — a disciplined, multi-session coding agent loop. (python -m tars)
    • tars/_cli_helpers.py — Shared CLI helpers: color and tty detection.
    • tars/act/__init__.py — TARS ACT — PHASE 4, isolated: the phase that actually touches the repo.
      • tars/act/base.py — The one interface every executor implements.
      • tars/act/local.py — The built-in executor: this machine, this repo, stdlib only.
      • tars/act/registry.py — Which executor does ACT's work, chosen by name rather than by import.
      • tars/act/types.py — What ACT was asked to do, and what came of it.
    • tars/browser/__init__.py — Efficient, accessibility-tree-first browser testing. (python -m tars.browser)
      • tars/browser/cli.pytars-browser: scriptable accessibility-tree web tests.
    • tars/loop/__init__.py — TARS loop orchestrator — the seven phases, driven. (python -m tars.loop)
      • tars/loop/_io.py — Small output helpers for the REPL.
      • tars/loop/cli.pytars — persistent REPL and one-shot loop commands.
      • tars/loop/engine.py — The seven-phase loop, composed from TARS's tested phase modules.
      • tars/loop/repl.py — The persistent slash-command interface over one live :class:Session.
      • tars/loop/session.py — What persists between commands.
      • tars/loop/session_store.py — Durable event log for REPL sessions.
      • tars/loop/tools.py — Model-facing ACT tools.
      • tars/loop/types.py — The loop's own vocabulary.
    • tars/memory/__init__.py — TARS memory writer — PHASE 6 (REFLECT), isolated. (python -m tars.memory)
      • tars/memory/cli.pytars-memory — the REFLECT phase as a command.
      • tars/memory/domains.py — Which partition does a fact belong to, and what said so.
      • tars/memory/propose.py — The REFLECT pass: read a transcript, propose what is worth remembering.
      • tars/memory/signals.py — Detectors for the sentence in core directive 4.
      • tars/memory/similarity.py — Small lexical similarity for memory retrieval without an embedding service.
  • …and 32 more modules

Tests live in tests/.

Verifying it

ruff check .
ruff format --check .
mypy tars tests
pytest

detected from this repo: format, lint, test, typecheck


Generated by tars-readme from the source of this repository: 6 examples extracted from the paths above. Sections with nothing to source were left out.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tars_agent-0.1.2.tar.gz (273.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tars_agent-0.1.2-py3-none-any.whl (190.9 kB view details)

Uploaded Python 3

File details

Details for the file tars_agent-0.1.2.tar.gz.

File metadata

  • Download URL: tars_agent-0.1.2.tar.gz
  • Upload date:
  • Size: 273.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for tars_agent-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d8bf851edb692fd1c733a9e712274a426d3b7d159d95d197709cdadcc030f4a0
MD5 270afcb9e9f7874e3616dbda89fb6d6d
BLAKE2b-256 1c7affb7bbbfef0c0050ad68891e11f5d10683c0f627335e2c31856fc3e04e1f

See more details on using hashes here.

File details

Details for the file tars_agent-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tars_agent-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 190.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for tars_agent-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4223b34e5ebbd8ed8c53c8c8a29b98c43a63f5cccc76d2df6fbe01faeb98274c
MD5 58325345304f5ddcf8d74f6b733fc598
BLAKE2b-256 770554015dcb008b8fcd5b42e0fdd567fed9985c37e663adeef95f8315c66972

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page