# Gravity Keep Vision

> **Status:** Draft 0.2, 2026-11-23. What Gravity Keep is, why it exists, the ideas it rests on, what it is not, and how it relates to the Gravity Standard. Companion to [Tree Model](tree-model.md), [Commit Model](commit-model.md), and [Rules](rules.md).

# 1. What it is

**Gravity Keep is a control plane for AWS, configured like a network device.**

A person opens a session, enters configuration mode, edits a **candidate** configuration, checks it, and **commits** it. The commit is numbered, commented, attributed, and reversible. From that moment the control plane's **reactors** work to make AWS match the committed configuration, and they keep it matching: when someone changes a resource in the console, CloudTrail reports it, a reactor compares the resource with the tree, and the difference is corrected or reported.

> Say what should be true. Commit it. Gravity pulls everything into line.

Three things are first-class:

1. **The tree.** One hierarchical configuration for everything the company runs in AWS. Namespaces are branches the company names for itself (a company, a business unit, an application, an environment). Resources are the leaves. Settings set on a branch flow down to everything beneath it.
2. **The commit.** The only way the configuration changes. A commit is atomic in the tree, checked before it lands, and kept forever in history.
3. **Convergence.** The continuous work of making AWS match the active configuration, triggered by commits and by observed changes, and always driven by comparing state rather than by replaying events.

# 2. Why build it

Terraform and CloudFormation are good tools, and both share habits that cost real teams time:

| Pain | What happens today | What Gravity Keep does instead |
|---|---|---|
| **Drift is found late** | Drift appears when someone runs a plan, often during an unrelated change, and blocks it. | Drift is observed within minutes from CloudTrail and handled by the namespace's drift policy ([commit-model 6](commit-model.md#6-drift)). |
| **State lives in a file** | A state file in a bucket, with a lock table, can be corrupted, split, or lost, and `state mv` surgery is a specialist skill. | Desired state is rows in Postgres with full history. Observed state is read from AWS. There is no third copy to repair. |
| **Hierarchy is simulated** | Organizations, accounts, regions, and environments are expressed through directories, workspaces, variables, and module wiring. | The hierarchy *is* the configuration. Placement (organization, account, region, zone) is inherited down the tree. |
| **Common settings are copied** | Encryption, tags, logging, and public-access blocks are repeated in every module call, or patched in with `default_tags` and policy checks after the fact. | A namespace states **defaults** (overridable) and **guardrails** (not overridable) once. Every resource beneath inherits them ([tree-model 5](tree-model.md#5-defaults-and-guardrails)). |
| **Moving things is surgery** | Reorganizing (an account moving under an organization, a service moving between environments) means state moves and careful imports. | Moving or renaming a namespace is one commit and never replaces a resource ([CTL-006](rules.md#tree)). |
| **Plan and apply drift apart** | A plan is a snapshot. By apply time the world may have moved. | Commit check plans against the latest observed state, and convergence re-reads state before each action. |
| **Changes that lock you out** | A bad security group or WAF rule can cut off the people who would fix it. | `commit confirmed 10` reverts automatically unless the change is confirmed in ten minutes, exactly as on a router ([commit-model 5](commit-model.md#5-commit-confirmed)). |

Gravity Keep also answers a Gravity Standard principle directly: **events over polling; state over events.** A CloudTrail event is a hint about where to look. The reactor reads the resource, compares it with the tree, and acts on the difference, so a duplicate, late, or lost event does no harm.

# 3. The metaphor

In the Gravity family, mass is useful. Gravity Scheduling lets the weight of the work set the pace. Gravity Migration uses decades of encoded behavior as a gravity assist. In Gravity Keep, **the committed configuration is the mass.** Anything that strays from it is pulled back, and the further down the tree a setting is declared, the more local its pull.

The name comes from **station-keeping**: the small, regular burns a satellite makes to correct its drift and stay in its assigned orbit. That is what Gravity Keep does all day for every resource in the tree. It was called Gravity Control until draft 0.2.

A small number of words carry the idea:

- **Orbit:** the resource matches its configuration. Nothing to do. (State `stable`.)
- **Drift:** the resource has moved away from its configuration. (Recorded as drift; state `drifted` only if nothing will pull it back.)
- **Pull:** a reactor acting to bring a resource back into orbit. (State `converging`.)
- **Hold:** a temporary, recorded suspension of pull, for break-glass work ([CTL-033](rules.md#drift)).

These are vocabulary for people. The documents use the plainer technical terms in the glossary.

# 4. Glossary

| Term | Meaning |
|---|---|
| Control plane | One running Gravity Keep: its store, reactors, sessions, and the AWS accounts it manages. One per deployment, in the Gravity Standard sense. |
| Tree | The whole configuration: a hierarchy of namespaces holding statements and resources. |
| Namespace | A named branch of the tree, chosen by the company (`tidewater`, `lending`, `prod`). Its path is its full name: `/tidewater/lending/prod`. |
| Statement | A setting on a namespace or resource: `set versioning status enabled`. |
| Resource | A leaf: one AWS resource, with a type, a name unique in its namespace, and properties. |
| Resource type | The kind of resource, taken from the CloudFormation registry schema (`AWS::S3::Bucket`) and written with a short derived alias (`s3.bucket`). |
| Placement | Where resources land: `organization`, `account`, `region`, and `zone`. Inherited down the tree. |
| Scope of a type | Whether a resource type is **global** (IAM role, Route 53 zone), **regional** (S3 bucket, Lambda function), or **zonal** (subnet, EBS volume). Decides which placement it needs. |
| Defaults | Settings a namespace offers everything beneath it. A nearer namespace or the resource itself may override them. |
| Guardrails | Settings a namespace imposes on everything beneath it. Nothing beneath may weaken them; commit check fails if anything does. |
| Template | A named, versioned, parameterized bundle of resources stood up together (a Gravity Standard Lambda with its log group, key, and alarms). |
| Instance | One use of a template at a path, with its parameter values. |
| Reference | A link from one resource's property to another resource or its attribute: `@/tidewater/foundation/keys/pii.arn`. Gives ordering. |
| Candidate | A private, uncommitted copy of the tree that a session edits. |
| Active configuration | The tree as of the latest successful commit. |
| Commit | An atomic change from one active configuration to the next, numbered, commented, and attributed. |
| Commit check | Everything a commit would verify and plan, without committing. |
| Convergence | Making AWS match the active configuration. Each commit tracks its convergence to `converged` or `failed`. |
| Observed state | What AWS reports for a managed resource, as of a time, stored beside the configuration. |
| State | Where a resource stands, and who has to act: `stable`, `converging`, `drifted`, `failed`, or `unknown`. A namespace shows the worst state beneath it. |
| Drift | A managed property whose observed value differs from its resolved configured value. |
| Drift policy | What an `owned` namespace does about drift: `remediate` (correct it automatically, the default) or `report`. |
| Ownership | Whether commits change AWS, and what happens to changes made outside a commit: `owned` (remediated or reported), `learning` (written into the tree), or `observed` (reported; nothing is ever changed). |
| Reactor | The Lambda that compares one resource's observed state with its configuration and acts on the difference. |
| Sweep | A scheduled read of every managed resource, so that a lost event is caught. |
| Inventory | The list of what exists in each managed account and region, from an inventory source such as Resource Explorer, so every resource is in the tree or listed as unmanaged. |
| Area | A namespace's placement, narrowed by types, regions, and tags: what explore searches and what learning watches. |
| Adoption | Bringing an existing, unmanaged AWS resource under a path in the tree without replacing it. |
| Explore | A one-time, targeted search of an area that adds every unmanaged resource found there to a candidate. |
| Learning | A namespace mode in which resources created, changed, or deleted in its area outside a commit are written into the tree. |
| Eviction | Taking resources or a branch out of the tree and leaving them running in AWS, untagged. The opposite of adoption. |
| Source | Where a namespace's configuration is written: the control plane (the default) or one file on one branch of a Git repository. Declared by the parent; one per subtree. |
| Binding | A namespace's declared tie to an application and environment, which sets their tags and makes production namespaces reviewed by default. |

# 5. Ideas it rests on

1. **The tree is the truth.** What the committed configuration says is what should exist. AWS is brought into line, never the other way round, except by a recorded adoption.
2. **One way to change, one writer per branch.** Everything changes by commit: a person at the CLI, a pipeline loading a reviewed file, or the control plane itself (an automatic revert, an adoption). Each is a commit with an author. Each branch has exactly one source, a session or a Git file, so two copies of the desired state never undo each other ([tree-model 11](tree-model.md#11-sources)).
3. **State over events.** Reactors act on current state compared with configuration. Events only say where to look. A periodic sweep catches anything an event missed.
4. **Inheritance over repetition.** A setting is declared once, at the highest namespace where it is true, and flows down.
5. **No expression language.** Templates substitute declared parameters. There are no loops, conditionals, or functions in the configuration ([CTL-018](rules.md#templates)), in keeping with the Standard's SCOPE-003. What would need logic is a new template or hand-written code.
6. **Safe by default.** Unmanaged resources are never deleted. Stateful resources are retained when removed from the tree unless the commit says otherwise. A destructive change is named in commit check and needs explicit acknowledgment.
7. **Say it, do it, prove it.** Commit check says what will happen. Convergence does it. The commit's convergence record proves what was done, resource by resource.

# 6. What it is not

- **Not multi-cloud.** It manages AWS, deeply. Terraform remains the better tool for estates spanning clouds and SaaS providers ([comparison 5](comparison.md#5-where-terraform-and-pulumi-win)).
- **Not a general programming environment for infrastructure.** There is no CDK-style code and no HCL-style expressions. The configuration is data.
- **Not a deployment pipeline.** It manages infrastructure. Building and promoting application artifacts stays the Gravity Standard's delivery ladder (Architecture 10), and a pipeline uses Gravity Keep the way it uses Terraform today: it loads a reviewed configuration and commits it.
- **Not a replacement for AWS Organizations controls.** Service control policies and tag policies are resources it manages, and they remain the hard boundary. Gravity Keep guardrails are checked at commit; SCPs are enforced by AWS at every call.
- **Not a backup system.** Rolling back a configuration restores configuration, never data ([CTL-029](rules.md#ownership-and-deletion)).

# 7. How it relates to the Gravity Standard

Gravity Keep sits in the Standard's **installation manual**: it is how the foundation and every application's infrastructure would be described and kept true.

- **It is built as a Gravity Standard application** ([architecture 1](architecture.md#1-shape)): its configuration store is a Data Domain, a commit's convergence is a Business Process compiled to Step Functions, and an adoption that needs approval is a human task. It holds its own permit.
- **It replaces the Standard's Terraform modules with templates.** The standard Lambda module, application stack module, process module, observability module, and database role module each become a template ([samples/templates.md](samples/templates.md)).
- **It leaves development permits where they are.** Permits govern applications, and stay checked in each application's pipeline, before the pipeline commits. Gravity Keep doesn't check them, so it can be used without them ([CTL-037](rules.md#access-and-governance), retired). It holds its own permits to run, as any Standard application does.
- **It keeps the tagging standard**, applied as guardrails at the top of the tree rather than through `default_tags`, and it adds a `gravity-path` tag so any resource can be traced to its branch.

**The dependency runs one way.** Gravity Keep builds on the Standard and refers to it; the Standard never refers to Gravity Keep, and nothing here asks it to change. The Standard says infrastructure is **Terraform, applied by pipeline only** (Architecture 3, 10.1), and Gravity Keep does not quietly override that. A company that uses Gravity Keep records the deviation as a `DESIGN-nnn`, the route the Standard already provides, and the [adoption path](adoption-path.md) shows how: observe-only beside Terraform, then owning namespaces under a decision per application, then a company-wide decision ([CTLQ-002](#9-questions)).

# 8. Success measures

- A person who has used a Junos device can make a first commit within fifteen minutes of their first session.
- A console change to a managed resource is observed within five minutes and handled by its namespace's drift policy.
- Moving a namespace (an account moving under an organization) is one commit that replaces no resources.
- Every resource in a managed account is either in the tree or listed as unmanaged, and every type the inventory can't see is named. Nothing is unknown silently.
- Rolling back to any earlier commit is one command and one commit, and commit check states exactly what it cannot restore.
- Tidewater's foundation and its three applications are described entirely by templates and the tree, with no Terraform.

# 9. Questions

| # | Question | Leaning |
|---|---|---|
| CTLQ-001 | **Reserved prefixes.** Should `CTL` and `CTLQ` be added to the Standard's reserved prefixes (CONV-012), as `MIG`, `EV`, and `DIFF` were for Gravity Migration? | **Resolved 2026-11-23: no.** The Standard must not need to know about Gravity Keep. Migration's prefixes are reserved because its records live in a company's specification repository; Gravity Keep's rules and questions live only in these documents and never appear in a company's specifications, so they can't collide. |
| CTLQ-002 | **Terraform in the Standard.** Does the Standard eventually name Gravity Keep as its infrastructure tool, name it as an allowed alternative, or keep Terraform? | **Resolved 2026-11-23.** The Standard is left as it is and never names Gravity Keep. A company uses Gravity Keep under a `DESIGN-nnn`, per application and then company-wide ([adoption-path 3](adoption-path.md#3-replace)). |
| CTLQ-003 | **Name of the client.** The command-line client is called `gkeep` in these documents (it was `gctl` while the product was Gravity Control). | Keep, unless it collides with a tool in common use; check against existing `gkeep` command-line tools for Google Keep before 1.0. |
