terrace

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT

README

terrace

Shared, gated infrastructure runs for you and your AI agent.

Working on a Terragrunt estate with an AI agent? Every plan and apply becomes a shared run you can follow live from any terminal. The agent applies only where your tiers allow, and the rest waits for an approval it can't give by mistake.

You approve the plan in OpenTofu's own words, with every deletion of data flagged, and an apply uses exactly the plan you saw. A delete in production also needs your own cloud sign-in. Terragrunt still does the work: terrace adds the record, the policy and the gate.

Go

terrace.hcl · Credentials · Agents · Known limits


Why terrace?

An agent that runs Terragrunt itself can apply whatever its credentials allow, and you see only what it tells you afterwards. With terrace, every run is in view, and the risky ones wait for you. It guards against mistakes, not against an agent set on getting round it.

  • Every run, live, in any terminal. The agent hands you terrace watch k7f2, and you follow its run in your own pane. Runs outlive the terminal that started them. Agents
  • Policy by unit, not by command. Tiers in terrace.hcl match units by path, and a folder run takes the strictest tier among its units. terrace.hcl
  • An approval the agent can't give by mistake. A run in a human tier waits for your Yes on Claude Code's prompt, or a in your terminal. Words in chat never approve. Agents
  • What you approve is what applies. The question shows each unit's plan as OpenTofu writes it, and an apply uses exactly those saved plan files. A stale plan never applies. A destroy is the exception: it plans again as it runs. Known limits
  • Deletes need your own sign-in. A plan that deletes or replaces in a human tier also needs an AWS sign-in as your delete user, in your browser, with whatever MFA Identity Center asks for. Credentials
  • The wrong account is refused. With the account guard set, terrace checks a run's credentials against the account ID in the unit's account.hcl before it touches state. terrace.hcl

With no terrace.hcl at all, plans run anywhere, and every apply and destroy waits for you. Until a tier names a delete sign-in that's set up, though, nothing can approve a delete, a replace or a destroy.

Screens


Home
The estate, its runs and its logins, in one place

The delete sign-in
Deletes wait for your own sign-in

show
Any run of the last 30 days, as it happened

A failure
OpenTofu's own error, and what to do next

runs
Today's runs, yours and the agent's

accounts
Logins, delete sign-ins and write access

Install

You need macOS, and Terragrunt 1.1.6 or later on your PATH, running OpenTofu 1.7 or Terraform 1.7 or later. The cloud checks and the delete sign-in support AWS.

brew install leeovery/tools/terrace

Or, with Go 1.27 or later:

go install \
  github.com/leeovery/terrace/cmd/terrace@latest

To remove it, first take terrace's hook out of each repo's .claude/settings.json: it fails closed, so without terrace it blocks every shell command in Claude Code. Then run brew uninstall terrace. For the go install route, delete terrace from $(go env GOBIN), or $(go env GOPATH)/bin where that's empty. Your run records stay in ~/.local/state/terrace.

A first run

# In your estate: set up Claude Code's gate
terrace setup
# Plan a folder, and watch it run
terrace plan acme-prod/production
# Browse the estate, its runs and logins
terrace

terrace setup writes the ask rules and the hook that keep approval with you, and the guide the agent reads, as a skill. Commit them, and start Claude Code in terrace's root: the folder that holds terrace.hcl, or the repo's top without one. Everyone who starts Claude Code there then needs terrace installed, because the hook blocks every shell command without it.

A plan shows a small live block while its units run, a line each, with OpenTofu's latest words. Then it prints each changing unit's plan into your scrollback, with the risks under them. A question follows, such as Apply 11 changes across 5 units? Press a to apply exactly the plan you read, or q to leave the offer standing until the plan expires.

The approval gate

What a run needs comes from its tiers and from the plan itself:

The run It needs
in a tier that allows it nothing
in a human tier your click
a delete or replace, in a human tier your click, then your delete sign-in
a destroy, in a human tier your click, then your delete sign-in
a delete, replace or destroy in a human tier, with no delete_signin set up nothing can approve it
in a never tier it's refused

An apply goes in rounds. A unit planned against mock outputs, or one that reads outputs the apply changes, waits for a second round, which plans it again, and asks again where its tier needs you. Tiers are set in terrace.hcl, and the sign-in in Credentials.

The agent's side

The agent starts each run with --json, gets its code back at once, and waits in the background with terrace wait. When a run needs you, it pastes the summary terrace gives, unchanged, adds its own read, and runs terrace approve <code>. Claude Code then asks you, showing terrace's one-line summary of the run.

The hook reads each command line the agent runs. It refuses raw applies, destroys and state writes written there, and any disguised approve. It can't see inside a script or a make target. Agents covers it, and the guide is what the agent reads.

Home

terrace on its own opens home, full screen. It shows the estate in columns of accounts, folders and units, with each unit's tier, last apply and runs. Runs going or waiting sit above the columns, and the logins below.

  • / finds a unit.
  • p or a plans or applies what's under the cursor.
  • s or w shows or watches its run.
  • q leaves.

Questions you may have

  • Does it replace Terragrunt? No. Each run is terragrunt run --all, which orders the units and passes their outputs. terrace never re-derives what Terragrunt does. terrace.hcl
  • Can a determined agent get round it? Yes. terrace guards against mistakes, not a hostile agent, and lists every way round it that's known. Known limits
  • Does it work with agents other than Claude Code? Any agent can read the guide and run terrace. The prompt and the hook are Claude Code's, so another agent gets neither: nothing refuses its raw applies, and only its credentials limit it. Agents
  • Does it log in for me? No. It checks each login before a run, and gives the command that fixes one. Credentials
  • Linux, or plain OpenTofu without Terragrunt? Not in v1: macOS and Terragrunt only.

Where next

  • terrace.hcl: tiers, the account guard, profiles and every setting.
  • Credentials: the profiles, the delete sign-in and the write-access check.
  • Agents: terrace setup, the hook and approval from Claude Code.
  • Known limits: what terrace doesn't protect against.
  • The guide: what the agent reads, with every --json field and exit status.

License

MIT

Directories

Path Synopsis
cmd
terrace command
Command terrace runs Terragrunt for a person and an AI agent together: shared live runs, tiered policy, and a human approval gate.
Command terrace runs Terragrunt for a person and an AI agent together: shared live runs, tiered policy, and a human approval gate.
internal
account
Package account reads the account guard's side in the tree: which account each unit is in, and the account ID its guard file expects.
Package account reads the account guard's side in the tree: which account each unit is in, and the account ID its guard file expects.
app
Package app assembles terrace from the process it runs in: git and Terragrunt over the runner, the cloud the build picks, the run records in the state folder, this machine and the wall clock, as the commands take them.
Package app assembles terrace from the process it runs in: git and Terragrunt over the runner, the cloud the build picks, the run records in the state folder, this machine and the wall clock, as the commands take them.
childenv
Package childenv builds the whole environment a child process gets, from the one terrace was given, so nothing inherited steers it unasked.
Package childenv builds the whole environment a child process gets, from the one terrace was given, so nothing inherited steers it unasked.
claudecode
Package claudecode owns what terrace keeps in a repo for Claude Code (spec 9.4): the ask rules and the PreToolUse hook its approval gate needs in the repo's .claude/settings.json, the one check of whether the settings hold them and nothing undoes them, which approve refuses without (5.4.5), and the setup that merges them in, beside the agent's guide as a skill (9.1.2).
Package claudecode owns what terrace keeps in a repo for Claude Code (spec 9.4): the ask rules and the PreToolUse hook its approval gate needs in the repo's .claude/settings.json, the one check of whether the settings hold them and nothing undoes them, which approve refuses without (5.4.5), and the setup that merges them in, beside the agent's guide as a skill (9.1.2).
cli
Package cli holds terrace's commands: each parses its command line, calls one operation, and writes the result.
Package cli holds terrace's commands: each parses its command line, calls one operation, and writes the result.
cloud
Package cloud is the contract for everything terrace asks the cloud: whose credentials a profile holds and until when, what the AWS config says of a profile, and whether the everyday credentials can delete in an account.
Package cloud is the contract for everything terrace asks the cloud: whose credentials a profile holds and until when, what the AWS config says of a profile, and whether the everyday credentials can delete in an account.
cloud/awscloud
Package awscloud is the cloud as AWS answers it, the release build's driver of cloud.Cloud.
Package awscloud is the cloud as AWS answers it, the release build's driver of cloud.Cloud.
cloud/cloudbuild
Package cloudbuild is the cloud this build carries: AWS in the release build, and the demo world's stand-in in the demo build (go build -tags demo), so neither binary holds the other's.
Package cloudbuild is the cloud this build carries: AWS in the release build, and the demo world's stand-in in the demo build (go build -tags demo), so neither binary holds the other's.
cloud/cloudtest
Package cloudtest is a cloud.Cloud a test programs, which counts what it's asked.
Package cloudtest is a cloud.Cloud a test programs, which counts what it's asked.
cloud/democloud
Package democloud is the demo world's cloud, a local stand-in for AWS that never touches the network: the demo build's driver of cloud.Cloud.
Package democloud is the demo world's cloud, a local stand-in for AWS that never touches the network: the demo build's driver of cloud.Cloud.
config
Package config reads terrace.hcl: the tiers that say what each verb needs in each part of the tree, the account guard, and the settings beside them.
Package config reads terrace.hcl: the tiers that say what each verb needs in each part of the tree, the account guard, and the settings beside them.
engine
Package engine takes a started run from its plan to its close (spec §4), in the run's own process.
Package engine takes a started run from its plan to its close (spec §4), in the run's own process.
errjoin
Package errjoin tells errors errors.Join made from other errors that wrap several: a join's words are its errors', a line apiece, where an error that wraps several in words of its own, as fmt.Errorf's of several %w, or one that carries facts of its own, says more than they do.
Package errjoin tells errors errors.Join made from other errors that wrap several: a join's words are its errors', a line apiece, where an error that wraps several in words of its own, as fmt.Errorf's of several %w, or one that carries facts of its own, says more than they do.
errkind
Package errkind names the kinds of error and refusal terrace reports, the kind field of --json's error.
Package errkind names the kinds of error and refusal terrace reports, the kind field of --json's error.
flow
Package flow draws a run in the terminal's normal flow, as it happens, from the run's own events (design/terminal-ui.md, "The live region"; decision 70): a small live block at the foot redraws in place, one status row a unit, and what has settled prints once and stays in the scrollback: each round's plan at its question, in OpenTofu's own words, and the apply's rows with the run's close.
Package flow draws a run in the terminal's normal flow, as it happens, from the run's own events (design/terminal-ui.md, "The live region"; decision 70): a small live block at the foot redraws in place, one status row a unit, and what has settled prints once and stays in the scrollback: each round's plan at its question, in OpenTofu's own words, and the apply's rows with the run's close.
frametest
Package frametest holds drawn terminal output to golden frames cell by cell (design/terminal-ui.md, "Testing").
Package frametest holds drawn terminal output to golden frames cell by cell (design/terminal-ui.md, "Testing").
git
Package git asks git about the work tree a folder is in: its top, its common git folder, its remotes, the work trees and other repos it holds, the folders it doesn't track or ignores, and the files that differ between commits.
Package git asks git about the work tree a folder is in: its top, its common git folder, its remotes, the work trees and other repos it holds, the folders it doesn't track or ignores, and the files that differ between commits.
git/gittest
Package gittest runs real git for tests, in an environment of the test's own, so the person's git config can't reach it, and gives the folders git names, by their physical paths.
Package gittest runs real git for tests, in an environment of the test's own, so the person's git config can't reach it, and gives the folders git names, by their physical paths.
guide
Package guide holds the agent's guide to terrace, which ships inside the binary so it always matches the version (spec 9.1): as `terrace guide` prints it, and as the Claude Code skill `terrace setup` writes.
Package guide holds the agent's guide to terrace, which ships inside the binary so it always matches the version (spec 9.1): as `terrace guide` prints it, and as the Claude Code skill `terrace setup` writes.
handoff
Package handoff hands the delete sign-in's keys from the view in the person's terminal that took them to the run's process, without touching disk (spec 5.5.8): over a unix socket in a folder of the run's own that only the user can reach, which the run's process listens on while the run waits for the sign-in.
Package handoff hands the delete sign-in's keys from the view in the person's terminal that took them to the run's process, without touching disk (spec 5.5.8): over a unix socket in a folder of the run's own that only the user can reach, which the run's process listens on while the run waits for the sign-in.
hcldiag
Package hcldiag reports a config terrace can't read, terrace.hcl or a guard file, as HCL's own diagnostics at each file and line.
Package hcldiag reports a config terrace can't read, terrace.hcl or a guard file, as HCL's own diagnostics at each file and line.
home
Package home is terrace with no command (design/terminal-ui.md, "The full-screen views"): Miller columns over the repo's accounts, folders and units as Terragrunt's discovery finds them, the unit under the cursor, the runs going or waiting, recent runs where rows are spare, the logins, and a search behind / that trims the tree to the units it matches.
Package home is terrace with no command (design/terminal-ui.md, "The full-screen views"): Miller columns over the repo's accounts, folders and units as Terragrunt's discovery finds them, the unit under the cursor, the runs going or waiting, recent runs where rows are spare, the logins, and a search behind / that trims the tree to the units it matches.
hook
Package hook reads a shell command line the agent would run, for terrace's PreToolUse hook in Claude Code (spec 5.6): the raw applies, destroys and state writes of Terragrunt, OpenTofu and Terraform it refuses, the `terrace approve` it passes to Claude Code's prompt only in the one form the ask rule matches, the writes to terrace's and Claude Code's files it asks about, and the lines it can't read, which it refuses.
Package hook reads a shell command line the agent would run, for terrace's PreToolUse hook in Claude Code (spec 5.6): the raw applies, destroys and state writes of Terragrunt, OpenTofu and Terraform it refuses, the `terrace approve` it passes to Claude Code's prompt only in the one form the ask rule matches, the writes to terrace's and Claude Code's files it asks about, and the lines it can't read, which it refuses.
ink
Package ink is how terrace's views colour what they draw: one accent of terrace's own over the terminal's own colours (design/terminal-ui.md, "Colour").
Package ink is how terrace's views colour what they draw: one accent of terrace's own over the terminal's own colours (design/terminal-ui.md, "Colour").
launch
Package launch joins a run's start to its engine in a process of the run's own (spec 4.1.5, 4.1.9).
Package launch joins a run's start to its engine in a process of the run's own (spec 4.1.5, 4.1.9).
lists
Package lists gathers what the lists print that no run holds (spec 8.2.3): each unit's outputs (3.1.7), the units under a folder with their tiers, last applies, drift and the runs that hold them (3.1.17), and each account's logins, delete sign-ins and write access (3.1.16).
Package lists gathers what the lists print that no run holds (spec 8.2.3): each unit's outputs (3.1.7), the units under a folder with their tiers, last applies, drift and the runs that hold them (3.1.17), and each account's logins, delete sign-ins and write access (3.1.16).
listview
Package listview draws the lists, which print and exit (design/terminal-ui.md, "The lists", "Per command"): runs, accounts, ls and output, and the lines cancel and note print.
Package listview draws the lists, which print and exit (design/terminal-ui.md, "The lists", "Per command"): runs, accounts, ls and output, and the lines cancel and note print.
machine
Package machine reads which Mac this process runs on, and which boot of it: what a run's record notes of where its process runs.
Package machine reads which Mac this process runs on, and which boot of it: what a run's record notes of where its process runs.
misetest
Package misetest finds the tools mise.toml pins for the tests that run them: the demo world takes its Terragrunt and OpenTofu from mise.
Package misetest finds the tools mise.toml pins for the tests that run them: the demo world takes its Terragrunt and OpenTofu from mise.
plan
Package plan reads a unit's plan JSON, as `tofu show -json` writes it, into the facts a run's summary is built from: its changes, their flags, the outputs it changes, and a copy of the JSON with every sensitive value masked.
Package plan reads a unit's plan JSON, as `tofu show -json` writes it, into the facts a run's summary is built from: its changes, their flags, the outputs it changes, and a copy of the JSON with every sensitive value masked.
record
Package record keeps run records (spec §10): each run's events, raw log, plan files and facts, in a per-user state folder that every clone and worktree of a repo shares.
Package record keeps run records (spec §10): each run's events, raw log, plan files and facts, in a per-user state folder that every clone and worktree of a repo shares.
regularfile
Package regularfile tells whether a regular file is at a name, where anything else there, or a file that can't be read, is an error rather than a reason to look elsewhere.
Package regularfile tells whether a regular file is at a name, where anything else there, or a file that can't be read, is an error rather than a reason to look elsewhere.
repo
Package repo finds the repo terrace works in: its root, the targets inside it, and the identity its clones and worktrees share.
Package repo finds the repo terrace works in: its root, the targets inside it, and the identity its clones and worktrees share.
runner
Package runner is the only code that starts a process.
Package runner is the only code that starts a process.
runner/runnertest
Package runnertest is a fake runner.Runner, seeded by command line, for the tests of each binary's adapter.
Package runnertest is a fake runner.Runner, seeded by command line, for the tests of each binary's adapter.
runs
Package runs reads and acts on a repo's kept runs, for the commands that take a run's code and for ls: it opens the records of the repo a folder is in, waits on a run (spec 9.2), cancels one and waits for its close (4.8.2), lists a day's runs (3.1.12), finds a unit's changes or one resource in full in a run's record (7.6), and reads what the kept runs say of a unit: its last apply, its drift and the runs that hold it (3.4.14).
Package runs reads and acts on a repo's kept runs, for the commands that take a run's code and for ls: it opens the records of the repo a folder is in, waits on a run (spec 9.2), cancels one and waits for its close (4.8.2), lists a day's runs (3.1.12), finds a unit's changes or one resource in full in a run's record (7.6), and reads what the kept runs say of a unit: its last apply, its drift and the runs that hold it (3.4.14).
screen
Package screen is the full-screen surface home draws on (design/terminal-ui.md, "The full-screen views"): the terminal's alternate screen, entered and left so the terminal ends as it was, a view drawn whole into it and drawn again on every key, resize and second, and the person's Ctrl-Z. It holds the key line too.
Package screen is the full-screen surface home draws on (design/terminal-ui.md, "The full-screen views"): the terminal's alternate screen, entered and left so the terminal ends as it was, a view drawn whole into it and drawn again on every key, resize and second, and the person's Ctrl-Z. It holds the key line too.
screen/screentest
Package screentest is the capture tool for the full-screen views (design/terminal-ui.md, "Testing"): it drives a real view, every seam it reads faked by its caller, as the surface does, through the keys a fixture names, and gives the frame it draws.
Package screentest is the capture tool for the full-screen views (design/terminal-ui.md, "Testing"): it drives a real view, every seam it reads faked by its caller, as the surface does, through the keys a fixture names, and gives the frame it draws.
seam
Package seam is the output seam's events: the facts a run's record holds, which every view of the run is drawn from.
Package seam is the output seam's events: the facts a run's record holds, which every view of the run is drawn from.
seam/seamtest
Package seamtest plays the frames' worlds as fixed events, as a run's record holds them: k7f2, the agent's apply of acme-prod/production in two rounds; its failure; p2g7, an apply that needs no approval; and h3w8, the click-only apply that expired (design/paper/round3/round3.py).
Package seamtest plays the frames' worlds as fixed events, as a run's record holds them: k7f2, the agent's apply of acme-prod/production in two rounds; its failure; p2g7, an apply that needs no approval; and h3w8, the click-only apply that expired (design/paper/round3/round3.py).
shellword
Package shellword writes a command line terrace hands to people to copy, a word at a time, as a POSIX shell or zsh reads it.
Package shellword writes a command line terrace hands to people to copy, a word at a time, as a POSIX shell or zsh reads it.
start
Package start starts a run: from the command's verb, target and flags to a run with its code and record, ready for its process to be detached, refusing it at the first pre-flight check that fails (spec 4.1, as decision 55 orders it).
Package start starts a run: from the command's verb, target and flags to a run with its code and record, ready for its process to be detached, refusing it at the first pre-flight check that fails (spec 4.1, as decision 55 orders it).
terminal
Package terminal is the one place terrace asks a terminal anything: whether a stream is one, its size, its background colour, and the keys typed at it while a run's view is up.
Package terminal is the one place terrace asks a terminal anything: whether a stream is one, its size, its background colour, and the keys typed at it while a run's view is up.
terragrunt
Package terragrunt runs the terragrunt binary: the one place its command line, its environment and its output are known.
Package terragrunt runs the terragrunt binary: the one place its command line, its environment and its output are known.
terragrunt/terragrunttest
Package terragrunttest is a Terragrunt a test scripts, in place of terragrunt.Client, which records what it's asked.
Package terragrunttest is a Terragrunt a test scripts, in place of terragrunt.Client, which records what it's asked.
testguard
Package testguard runs a package's tests in a world of their own: a throwaway home, no AWS variables, instance metadata off, and a network of loopback alone.
Package testguard runs a package's tests in a world of their own: a throwaway home, no AWS variables, instance metadata off, and a network of loopback alone.
unit
Package unit names units and folders by their path from the repo's root, the one name every clone and worktree of a repo shares.
Package unit names units and folders by their path from the repo's root, the one name every clone and worktree of a repo shares.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL