| 1 | # the-valley |
| 2 | |
| 3 | > 谷神不死,是謂玄牝。玄牝之門,是謂天地根。 |
| 4 | > *The valley spirit never dies. It is called the mysterious female. The gateway of the mysterious female is the root of heaven and earth.* |
| 5 | > — Tao Te Ching, ch. 6 |
| 6 | |
| 7 | A space to rethink developer workflow and source management from scratch. |
| 8 | |
| 9 | This is not a project to "move off GitHub." That framing is too narrow. The question is: **what would source management look like if designed today**, with AI agents as first-class authors, Nix as a substrate, and no assumption that a single platform should own hosting, identity, CI, artifacts, review, and automation? |
| 10 | |
| 11 | ## Constraints |
| 12 | |
| 13 | - **Open source.** |
| 14 | - **Minimal.** Prefer composing small tools over building a platform. |
| 15 | - **Nix-native.** Builds, verification, and artifacts are derivations. |
| 16 | - **Decentralized where possible.** Accept centralization only where ordering or coordination genuinely require it, and be explicit about it. |
| 17 | |
| 18 | ## What GitHub does, broken out |
| 19 | |
| 20 | GitHub bundles seven things. Most of them it does poorly enough that unbundling looks attractive: |
| 21 | |
| 22 | | Concern | Current state | Direction | |
| 23 | | ------------------- | ------------------------------ | ------------------------------------------------------ | |
| 24 | | Hosting | Works fine, lock-in is the cost | Bare git over SSH on a Tailscale-reachable box | |
| 25 | | Identity / access | Works fine | Tailscale ACLs + SSH keys | |
| 26 | | Verification | Slow, YAML-shaped | `nix flake check` triggered by events | |
| 27 | | Artifacts | Opaque, ephemeral | Nix derivations, content-addressed, pushed to a cache | |
| 28 | | Automation | Actions: push-based, brittle | Reactive controllers subscribing to an event log | |
| 29 | | Review | PR-shaped, poor fit for agents | **Open question.** The most interesting design problem | |
| 30 | | Issues / discussion | Bolted on | Out of scope for now | |
| 31 | |
| 32 | ## Shape of the system |
| 33 | |
| 34 | ``` |
| 35 | bare git (Tailscale) ──┐ |
| 36 | build outputs ───┤ |
| 37 | agent runs (klaus) ───┼──► event log ──► subscribers |
| 38 | deploy state ───┤ (NATS JS) │ |
| 39 | external signals ──┘ ├──► nix build (pure reactions) |
| 40 | └──► armstrong (effectful reactions) |
| 41 | ``` |
| 42 | |
| 43 | - **Hosting**: bare git over SSH. Each repo is just a directory. `cgit` or similar for browsing if needed. |
| 44 | - **Bus**: NATS JetStream. Single binary, persistent streams, runs on the same Tailscale box. This is the one piece of unavoidable centralization — append-only ordering needs an authority. Replicate later if the box becomes a constraint. |
| 45 | - **Pure reactions**: Nix derivations. Inputs are events (refs, flake locks), outputs are content-addressed artifacts. Replayable from the log. |
| 46 | - **Effectful reactions**: [armstrong](https://github.com/gunk-dev/armstrong) as a Go controller. Subscribes to events and emits side-effects: deploys, notifications, agent dispatches, review-state changes. This is the controller-shaped successor to the current Actions-based armstrong. |
| 47 | - **Schemas**: CUE, already used by armstrong. Shared across event producers and consumers. |
| 48 | |
| 49 | ## Why a log, not a workflow engine |
| 50 | |
| 51 | GitHub Actions, GitLab CI, Jenkins — all push-based pipelines. An event happens, a workflow runs, it exits, the trail is a log file. |
| 52 | |
| 53 | A reactive log inverts this: |
| 54 | |
| 55 | - **Causality is preserved.** The chain of "commit → build → deploy → notification" is one queryable history, not seven disconnected job UIs. |
| 56 | - **Reactions are independent.** Adding a new subscriber doesn't touch any other subscriber or any workflow file. |
| 57 | - **Replay is free.** Want to know what would have happened if a reaction had been different? Replay the log against a new subscriber. |
| 58 | - **No central workflow file.** Each subscriber owns its own logic and lifecycle. |
| 59 | |
| 60 | Prior art: Atomist (defunct, but had this model). Kubernetes controllers. Datomic / event sourcing generally. `git` itself — commits are events, refs are views. |
| 61 | |
| 62 | ## Open questions |
| 63 | |
| 64 | 1. **Review.** What is the unit of review when most commits come from agents? The PR-as-thread model assumes human authorship and human disagreement. Agent-authored changes arrive with intent, diff, and verification artifacts already bundled — what does a useful review interface look like over that? |
| 65 | 2. **Discovery.** Without GitHub-the-social-graph, how do humans find each other's repos? Probably out of scope, but worth naming. |
| 66 | 3. **The log is a single point of failure.** Accepted for now. Replication is cheap when it's needed. |
| 67 | 4. **Schema evolution.** CUE handles validation, but event schemas will change. Migration story? |
| 68 | |
| 69 | ## Status |
| 70 | |
| 71 | Sketch. Nothing built yet. This document is the design space, not a plan. |