AI Collab Server
Centralized remote repository for the llm-git ecosystem: a RESTful API for semantic commits (with intent, prompt, and invoking AI model) plus Content-Addressed Storage (CAS) for artifact blobs — extending local-first DAGs into a synchronized multi-user environment.
Architecture
REST API
1. Upload Artifacts (Blobs)
Hash file contents and store immutably before referencing them in a commit.
POST /api/v1/objects/upload (multipart form: file)
→ returns SHA-256 hash
2. Create a Semantic Commit
Link blobs into the DAG with full AI metadata — what was asked, why, and by which model.
POST /api/v1/commits
{
"message": "Implement user authentication subsystem",
"snapshot": { "src/auth.py": "e3b0c442..." },
"parent_ids": ["prev-commit-id-8char"],
"intent": "Secure the API routes using JWT tokens.",
"prompt": "Create a FastAPI authentication wrapper using standard JWT claims.",
"model": "gpt-4-turbo"
}
3. Reconstruct Network Topology
GET /api/v1/commits → all Commit objects (DAG reconstruction) GET /api/v1/objects/{sha} → raw octet-stream blob
Interactive Swagger docs auto-served at http://localhost:8002/docs. Server config is env-driven via pydantic-settings (HOST, PORT, STORAGE_BASE_DIR, DATABASE_URL).
Core Paradigms
Semantic Separation
Like Git, metadata (commits) and objects (blobs) are stored entirely separately.
Immutability (CAS)
Files keyed by SHA-256 payload — identical files resolve to the same hash, auto-deduplicating network storage.
Topological Mapping
Commits define causal history via node-to-node parent IDs while embedding prompt, intent, and model metadata.
Codebase Layout
├── main.py # ASGI application factory & global routing
├── requirements.txt # FastAPI, SQLAlchemy, pydantic-settings
├── app/
│ ├── api/routes.py # Endpoint definitions (/commits, /objects)
│ ├── core/config.py # BaseSettings env injection
│ ├── core/models.py # Pydantic v2 request schemas
│ ├── infrastructure/database.py # SQLAlchemy engine + SQLite mapping
│ └── services/storage.py # Pure hash-based CAS logic
└── storage/ # Autogenerated persistence
├── metadata/collab.db # SQLite DAG topology
└── objects/ # Raw blobs keyed by hash (e.g. /e3/b0c442…)
Clean Architecture per Google Python Style Guide: core (domain) → infrastructure (persistence) → services (capabilities) → api (routing).