| 1 | # the-valley |
| 2 | |
| 3 | > "The valley spirit never dies; it is named the mysterious female. The gateway of the mysterious |
| 4 | > female is called the root of heaven and earth." — _Tao Te Ching, Chapter 6_ |
| 5 | |
| 6 | A clean-slate design for source management, verification, and developer workflow. |
| 7 | |
| 8 | The question behind this project is simple: **What would source management look like if designed |
| 9 | today from first principles?** |
| 10 | |
| 11 | If we assume AI agents are first-class authors and no single vendor should own hosting, identity, |
| 12 | CI, artifacts, review, and automation, how would we build the substrate? |
| 13 | |
| 14 | ## The Problem with the Monolith |
| 15 | |
| 16 | Modern software development relies heavily on centralized platforms like GitHub. While convenient, |
| 17 | bundling every concern into a single hosted platform creates friction that compounds as software |
| 18 | development shifts toward autonomous agents: |
| 19 | |
| 20 | - **CI is slow, brittle, and YAML-shaped.** The core verification loop takes minutes on third-party |
| 21 | infrastructure, configured in a proprietary dialect decoupled from local development. |
| 22 | - **The pull request conflates four distinct concerns.** Coordination, gating, historical record, |
| 23 | and notifications are forced into a single web page. Each concern is served worse than a |
| 24 | purpose-built mechanism would serve it. |
| 25 | - **Agents are treated as second-class citizens.** Centralized platforms are built around human |
| 26 | operators clicking in a web browser. Agents that author code, inspect documentation, or react to |
| 27 | events must navigate APIs designed for external bots. |
| 28 | - **Project knowledge is fragmented.** Issues, pull request discussions, wikis, and design documents |
| 29 | are scattered across proprietary databases, invisible to the tools and agents doing the daily |
| 30 | work. |
| 31 | |
| 32 | ## The Valley Model |
| 33 | |
| 34 | In Daoist philosophy, the valley is powerful because it stays low, open, and receives all streams |
| 35 | without grasping or imposing artificial shape. |
| 36 | |
| 37 | `the-valley` applies this principle to software development: **compose small, focused tools over a |
| 38 | durable substrate you own.** Instead of forcing all development through a monolithic cloud platform, |
| 39 | each concern receives an unbundled, purpose-built mechanism: |
| 40 | |
| 41 | - **Hosting:** Sovereign bare git repositories over Tailscale, backed up offsite. |
| 42 | - **Verification:** Hermetic Nix derivations producing cryptographic attestations locally in |
| 43 | seconds, replacing slow remote CI gates. |
| 44 | - **Integration:** A pull-based integrator controller that validates attestations and merges changes |
| 45 | without synchronous pre-receive blocking. |
| 46 | - **Automation:** An event log (NATS JetStream) where repository ref updates, builds, and deploys |
| 47 | are projected as replayable events. |
| 48 | - **Project Knowledge:** A typed markdown graph (`.the-valley/`) stored directly in the repository |
| 49 | alongside the code, navigable by humans and agents alike. |
| 50 | |
| 51 | ## The Ultimate Destination: An Outcome Engine |
| 52 | |
| 53 | At its fullest expression, `the-valley` is a **recursive, transparent outcome-production engine**. |
| 54 | |
| 55 | The fundamental unit of work is an **outcome**—a clear statement of a desired state that does not |
| 56 | yet exist. Outcomes form a directed acyclic graph (DAG) of dependencies. Schedulers inspect this |
| 57 | graph, identify the unblocked frontier of work, and dispatch agents or human operators to complete |
| 58 | it. |
| 59 | |
| 60 | Because the system is recursive, **the valley builds the valley**: its own configurations, policies, |
| 61 | and controller improvements are tracked as outcomes and integrated through the same verified |
| 62 | pipeline as user code. |
| 63 | |
| 64 | ## Core Constraints |
| 65 | |
| 66 | - **Open Source:** The substrate must remain fully inspectable, portable, and forkable. |
| 67 | - **Minimal:** Prefer composing small, single-purpose tools over constructing a complex monolithic |
| 68 | platform. |
| 69 | - **Nix-Native:** Builds, verification, and artifacts run as hermetic Nix derivations. Nix serves as |
| 70 | the reference backend, while schemas remain portable. |
| 71 | - **Decentralized by Default:** Centralization is accepted only where strict ordering or |
| 72 | coordination genuinely requires it. |
| 73 | |
| 74 | ## Current Status |
| 75 | |
| 76 | `the-valley` is currently in **Phase 0 (Durable Self-Hosting & Knowledge v0)**: |
| 77 | |
| 78 | - **Host Declarations:** Declarative CUE schemas ([`schema/valley.cue`](./schema/valley.cue)) define |
| 79 | valley hosts, projects, push mirrors, and backup policies. |
| 80 | - **NixOS Module:** A NixOS module ([`flake.nix`](./flake.nix)) installs and manages a sovereign |
| 81 | valley host from that declaration. |
| 82 | - **Event Bus:** An initial event bus projects git ref updates as structured events |
| 83 | ([`schema/events.cue`](./schema/events.cue)), observable via `valley tail`. |
| 84 | - **Knowledge Graph Conventions:** A frontmatter schema ([`schema/node.cue`](./schema/node.cue)) and |
| 85 | flake lint (`lib.knowledgeLint`) validate typed markdown nodes across repositories. |
| 86 | |
| 87 | ## Documentation Roadmap |
| 88 | |
| 89 | - [**design/user-scenarios.md**](./design/user-scenarios.md) — The escalating ladder of user |
| 90 | scenarios (S1 through S7) that ground all system requirements. |
| 91 | - [**design/requirements.md**](./design/requirements.md) — The functional requirements, constraints, |
| 92 | and non-goals derived from user scenarios. |
| 93 | - [**design/architecture.md**](./design/architecture.md) — Architectural choices, component |
| 94 | responsibilities, and technical rationale. |
| 95 | - [**design/integration.md**](./design/integration.md) — Specification for integration requests, |
| 96 | optimistic concurrency control, and verdict evaluation. |
| 97 | - [**design/verification.md**](./design/verification.md) — Specifications for pure vs. effectful |
| 98 | checks, tree digests, and cryptographic attestations. |
| 99 | - [**design/contribute.md**](./design/contribute.md) — Step-by-step protocol for human and agent |
| 100 | contributors. |
| 101 | - [**design/self-transparency.md**](./design/self-transparency.md) — Invariant analysis: ensuring no |
| 102 | actor can durably change the system without transparent record. |
| 103 | - [**design/openquestions.md**](./design/openquestions.md) — Open technical and architectural |
| 104 | questions. |
| 105 | - [**design/roadmap.md**](./design/roadmap.md) — The phased validation plan. |
| 106 | - [**bin/valley**](./bin/valley) — The valley CLI utility for inspecting pending requests, reviews, |
| 107 | and verification policies. |