Skip to content

Memory Conventions Reference

The configuration directory is the desired-state store — the .tf files you write hold every declaration. Agent memory’s job shrank accordingly: it holds the pointers and context that make a workflow findable across sessions, never the configuration itself. Duplicating config into memory invites drift between two records of intent; the directory is the single source of truth, and init on its path rediscovers everything it declares.

Adapt the storage mechanics to whatever your memory facility supports (key/value, markdown files, structured records). The content discipline is what matters.

One entry per workflow (not per resource). Recommended key: infra/<workflow-name>.

infra/staging-api
# Config: /home/user/proj/staging-api (config_alias: default)
# Backend: s3 (bucket=mco-tfstate, key=staging) — creds via AWS_PROFILE=mco
# Workspace: staging
# Providers: aws (env creds), random (no config)
# Intent: Staging environment for the API. Owned by api-team.
# Notes: kubernetes provider is fed by the cluster output — its resources
# defer to round 2 on a fresh cluster (provider_config_unknown).
  • Config path — the one thing you cannot rediscover: where the directory lives. Include the config_alias when it isn’t the default.
  • Backend identity — which state is whose, plus where credentials come from (env-var or profile names, never values). init re-reads the declared backend; this line is for disambiguation and secrets provenance.
  • Workspace name — matters when the same backend hosts several workspaces (staging/production).
  • Intent and notes — the human context a directory can’t carry: why the workflow exists, conventions, provider quirks, deferral gotchas.
  • Resource configs / HCL bodies — they live in the configuration directory. Find them by reading the directory’s .tf files directly; change them with file edits + up.
  • Secrets — no access keys, connection strings, or tokens, ever. Record the env-var name the operator must set.
  • Computed attributes (id, arn, endpoints, timestamps) — they live in state. When a value must be retrievable later, make it a root output (an output {} block) and read it back with output({}) — durable state is the queryable record of applied results.
  • Planning artifacts — plan digests, plan URIs, plan diffs. A convergence that outlives the conversation is found again from its workspace (open reports it), so even a convergence_id need not be remembered.
  • Agent reasoning or history — entries describe what is, not what we considered.
init({ path: "<the entry's directory>" }) # rediscover backend, providers, variables; install
open({ workspace_name: "<entry's>" }) # backend from the configuration; backend_config only for
# secrets, per the entry's provenance notes
up({ var: { … } }) # the values the configuration waits for; no-ops, drift
# and orphans surface in the plan at once

Update the entry when the pointer facts change (directory moved, backend migrated, new provider needing credentials) — not on every apply. The directory and state already track applies.

Turf™ is a trademark of Turf LLC. Terraform® is a trademark of HashiCorp. Ansible® is a trademark of Red Hat, LLC, registered in the United States and other countries. Helm®, Kubernetes®, Prometheus® and OpenTelemetry® are registered trademarks, and Jaeger™ is a trademark, of the Linux Foundation. OpenTofu® and Model Context Protocol® are registered trademarks of LF Projects, LLC. All other trademarks are the property of their respective owners. Turf is not affiliated with, endorsed by, or sponsored by HashiCorp, IBM, Red Hat, the Linux Foundation, LF Projects or the OpenTofu project.

© 2026 Turf LLC. Free for individuals, education and small businesses within the Community limits, under the Turf Community Edition License 1.0. Government and larger organizations need a commerciallicense.turf.build · Discord ·GitHub