Skip to content

Commit 422a264

Browse files
mahabubul470claude
andcommitted
Phase 0: workspace scaffold + gpp-core object store + gpp-cli
- Cargo workspace with all 21 crate stubs (gpp-core/gpp-cli implemented) - gpp-core: content-addressed store (BLAKE3 + zstd), Blob/Tree objects, GPP wire format, atomic idempotent writes, hash-verified reads - gpp-cli: `gpp init`, `gpp status`, `gpp config` (get/set/list/edit) - .gpp/ layout per docs/ARCHITECTURE.md; config.toml per docs/DATA_MODEL.md - CI: cargo fmt, clippy -D warnings, test (.github/workflows/ci.yml) - Docs relocated into docs/, CLAUDE.md + Cargo.toml at root Tests: gpp-core 21/21, gpp-cli e2e 7/7. fmt + clippy clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 parents  commit 422a264

69 files changed

Lines changed: 8805 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
check:
13+
name: fmt · clippy · test
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install Rust toolchain
19+
uses: dtolnay/rust-toolchain@stable
20+
with:
21+
components: rustfmt, clippy
22+
23+
- name: Cache cargo
24+
uses: Swatinem/rust-cache@v2
25+
26+
- name: rustfmt
27+
run: cargo fmt --all -- --check
28+
29+
- name: clippy
30+
run: cargo clippy --workspace --all-targets -- -D warnings
31+
32+
- name: test
33+
run: cargo test --workspace

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Rust build artifacts
2+
/target
3+
**/*.rs.bk
4+
5+
# A gpp repo's own runtime state (don't commit it into the gpp source tree)
6+
.gpp/
7+
8+
# Provided source bundle (docs already unpacked into docs/)
9+
/files.zip

CLAUDE.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# CLAUDE.md — gpp (git++) Project Context
2+
3+
## What is gpp?
4+
5+
gpp (git++) is an AI-native version control system built in Rust. It replaces Git's commit-centric model with a continuous-capture architecture designed for a world where AI agents are first-class code contributors.
6+
7+
The core insight: Git was designed for humans making deliberate, sequential commits. AI agents produce changes continuously, across multiple files simultaneously, faster than humans can review. gpp is built for this reality.
8+
9+
## Project Structure
10+
11+
```
12+
gpp/
13+
├── CLAUDE.md # You are here
14+
├── Cargo.toml # Workspace root
15+
├── crates/
16+
│ ├── gpp-core/ # Storage, objects, content-addressing
17+
│ ├── gpp-timeline/ # Continuous change capture engine
18+
│ ├── gpp-history/ # Curated changeset management + review workflow
19+
│ ├── gpp-graphex/ # Encrypted knowledge graph
20+
│ ├── gpp-trust/ # Agent reputation & behavioral RBAC
21+
│ ├── gpp-policy/ # Compliance-as-code engine
22+
│ ├── gpp-diff/ # Semantic diff engine (tree-sitter based)
23+
│ ├── gpp-sync/ # CRDT-based P2P replication
24+
│ ├── gpp-relay/ # Always-on relay node (sync hub, no special authority)
25+
│ ├── gpp-cost/ # Token/compute cost attribution
26+
│ ├── gpp-deps/ # Dependency intelligence
27+
│ ├── gpp-anomaly/ # Pattern detection & alerting
28+
│ ├── gpp-replay/ # Reproducible agent environments
29+
│ ├── gpp-notify/ # Event system, webhooks, chat/PM integrations
30+
│ ├── gpp-remote/ # Platform integration (GitHub, GitLab, Bitbucket APIs)
31+
│ ├── gpp-review/ # Code review workflow engine
32+
│ ├── gpp-rbac/ # Human permission model (owner/maintainer/contributor/reader)
33+
│ ├── gpp-cli/ # CLI binary
34+
│ ├── gpp-tui/ # Terminal UI (ratatui-based, lazygit-style)
35+
│ ├── gpp-sdk/ # Agent SDK (Rust + FFI for Python/JS)
36+
│ └── gpp-git-bridge/ # Git import/export compatibility
37+
├── extensions/
38+
│ ├── gh-gpp/ # GitHub CLI (`gh`) extension
39+
│ ├── vscode-gpp/ # VS Code extension (TypeScript)
40+
│ └── neovim-gpp/ # Neovim plugin (Lua)
41+
├── docs/
42+
│ ├── ARCHITECTURE.md
43+
│ ├── DATA_MODEL.md
44+
│ ├── CLI_SPEC.md
45+
│ ├── GRAPHEX_PROTOCOL.md
46+
│ ├── SYNC_PROTOCOL.md
47+
│ ├── SECURITY_MODEL.md
48+
│ ├── ROADMAP.md
49+
│ └── CONTRIBUTING.md
50+
├── parsers/ # Tree-sitter grammars for semantic diff
51+
│ ├── rust/
52+
│ ├── python/
53+
│ ├── typescript/
54+
│ └── go/
55+
├── policies/ # Built-in compliance policy templates
56+
│ ├── secrets-scan.policy
57+
│ ├── pci-dss.policy
58+
│ └── bangladesh-bank-pso.policy
59+
└── tests/
60+
├── integration/
61+
├── fixtures/
62+
└── benchmarks/
63+
```
64+
65+
## Architecture Overview
66+
67+
gpp is organized as 12 core layers + 5 integration layers, each a separate Rust crate in a Cargo workspace:
68+
69+
### Core Layers
70+
1. **Storage** (gpp-core) — Content-addressed encrypted blob store
71+
2. **Timeline** (gpp-timeline) — Continuous append-only file change capture
72+
3. **History** (gpp-history) — Curated changesets promoted from timeline
73+
4. **Graphex** (gpp-graphex) — Encrypted versioned knowledge graph
74+
5. **Trust** (gpp-trust) — Agent reputation scoring and behavioral RBAC
75+
6. **Policy** (gpp-policy) — Compliance-as-code enforcement at storage layer
76+
7. **Semantic Diff** (gpp-diff) — Tree-sitter based structural code diffing
77+
8. **Sync** (gpp-sync) — CRDT-based offline-first P2P replication
78+
9. **Cost** (gpp-cost) — Token and compute cost attribution per changeset
79+
10. **Dependencies** (gpp-deps) — Live risk-aware dependency intelligence
80+
11. **Anomaly** (gpp-anomaly) — Agent behavior pattern detection
81+
12. **Replay** (gpp-replay) — Reproducible agent environment snapshots
82+
83+
### Integration Layers
84+
13. **Relay** (gpp-relay) — Always-on sync hub (not a server with authority — just a persistent peer)
85+
14. **Review** (gpp-review) — Code review workflow (pending/approved/rejected/changes-requested)
86+
15. **RBAC** (gpp-rbac) — Human permission model (owner/maintainer/contributor/reader)
87+
16. **Notify** (gpp-notify) — Event system with webhooks, Slack/Discord/email integration
88+
17. **Remote** (gpp-remote) — Platform integration layer (GitHub, GitLab, Bitbucket APIs)
89+
90+
### Client Interfaces
91+
- **CLI** (gpp-cli) — Primary command-line interface
92+
- **TUI** (gpp-tui) — Interactive terminal UI (ratatui-based, lazygit-style)
93+
- **SDK** (gpp-sdk) — Agent SDK with Rust + Python + JS bindings
94+
- **MCP Server** — Model Context Protocol server for AI tool integration
95+
- **gh-gpp** — GitHub CLI extension
96+
- **vscode-gpp** — VS Code extension
97+
- **neovim-gpp** — Neovim plugin
98+
99+
### Agent Interaction Tiers
100+
gpp supports three tiers of AI agent integration:
101+
- **Tier 1 (Passive):** Agent edits files normally, timeline captures everything. Zero config. Works with any AI tool.
102+
- **Tier 2 (Context-aware):** Agent connects via MCP, queries Graphex for project context. Better changes because of context.
103+
- **Tier 3 (Native):** Agent uses gpp SDK directly — creates exploration branches, proposes changesets with intent, reports costs.
104+
105+
### Deployment Modes
106+
- **Mode 1 (Serverless P2P):** Direct peer-to-peer sync. No hosted dependency.
107+
- **Mode 2 (Relay):** `gpp-relay` binary as always-online sync hub. Any team member can run one. Stores encrypted objects, never decrypts.
108+
- **Mode 3 (Hosted Platform):** Optional `gpp.dev` web UI for browsing, reviewing, dashboards. Everything works without it.
109+
110+
### GitHub Integration Strategy
111+
gpp treats GitHub as a first-class sync target, not a competitor. The Git bridge pushes/pulls normal Git commits. Graphex, timeline, trust, cost, and policies live locally — GitHub only sees clean Git history. Optional GitHub API integration via `gpp remote` enables auto-opening PRs with rich descriptions, syncing issue references, and CI/CD hooks.
112+
113+
## Key Design Decisions
114+
115+
- **Rust only.** Performance, memory safety, single binary distribution. No runtime dependencies.
116+
- **Content-addressed storage** using BLAKE3 hashing (faster than SHA-256, cryptographically secure).
117+
- **Encryption via age (filippo.io/age)** for the Graphex layer and sensitive metadata.
118+
- **Tree-sitter** for language-aware semantic diffing — pluggable parsers per language.
119+
- **CRDT (Conflict-free Replicated Data Types)** for sync — specifically Automerge-style operation-based CRDTs.
120+
- **SQLite** for local indexes (timeline index, graph adjacency, trust scores) — embedded, no server.
121+
- **Git bridge** for import/export compatibility — never break existing workflows.
122+
- **MCP (Model Context Protocol)** for agent SDK integration — agents query Graphex via MCP server.
123+
124+
## Conventions
125+
126+
- All monetary/token cost values stored as integers (micro-dollars, 1 = $0.000001)
127+
- All timestamps are UTC, stored as i64 Unix microseconds
128+
- All IDs are BLAKE3 hashes, displayed as base32 (human-readable, case-insensitive)
129+
- Error handling uses `thiserror` for library crates, `anyhow` for CLI
130+
- Logging uses `tracing` crate throughout
131+
- Config files use TOML format
132+
- Test coverage target: 80%+ for core crates, 60%+ for CLI
133+
134+
## Build & Run
135+
136+
```bash
137+
cargo build --release
138+
cargo test --workspace
139+
cargo run --bin gpp -- init --graphex
140+
```
141+
142+
## What NOT to Do
143+
144+
- Do NOT add any C dependencies — pure Rust or Rust bindings only
145+
- Do NOT use async in the storage layer — keep it synchronous for simplicity
146+
- Do NOT store plaintext secrets anywhere, even in test fixtures
147+
- Do NOT break Git bridge compatibility without explicit approval
148+
- Do NOT use unwrap() in library code — always propagate errors

0 commit comments

Comments
 (0)