Spaces:
Sleeping
Sleeping
File size: 11,577 Bytes
a02272f c123839 a02272f 64b4b5e a02272f abcbf4b a02272f abcbf4b a02272f 5d2536d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | ---
title: Ever Brain
emoji: π§
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
---
<!--
### AGENT DIRECTIVE
This project is powered by Ever Brain Cognition OS.
To synchronize with the project's persistent memory and architectural state,
you MUST read AGENT.md in the root directory before starting any task.
-->
<p align="center">
<h1 align="center">Ever Brain</h1>
<p align="center"><strong>A Cognition Operating System for AI Coding Agents</strong></p>
<p align="center">
Persistent · Portable · Markdown-Native · Open Source
</p>
</p>
---
> AI agents lose operational continuity across sessions, tools, projects, and models.
> **Ever Brain** fixes this.
Every time you start a new AI session, switch from Claude to Cursor, change tools, resume an old project, or hit usage limits β the new AI instance loses **everything**: project understanding, architecture decisions, workflow continuity, coding preferences, active tasks, and operational memory.
**Brain** creates persistent, portable cognition layers shared between you and your AI agents through a markdown-based filesystem protocol. The agents remain the intelligence. Brain preserves continuity.
---
## What Brain Is (and Isn't)
Brain is **not** a chatbot, note-taking app, memory SaaS, or AI coding assistant.
Brain **is** a filesystem-based continuity infrastructure layer for AI-assisted development.
| What you get | What you avoid |
|---|---|
| Persistent memory across sessions | No databases or vector stores |
| Portable across AI tools & models | No cloud infrastructure |
| Fully local, user-owned data | No vendor lock-in |
| Markdown β human & AI readable | No proprietary formats |
| Git-compatible versioning | No background daemons |
---
## Quick Start
### Prerequisites
- Python 3.11+
- pip
### Install
```bash
# Clone the repository
git clone https://huggingface.co/spaces/projectsorg/ever-brain
cd ever-brain
# Install globally (editable mode)
pip install -e .
```
### First Brain in 60 Seconds
```bash
# 1. Create a Brain Instance
brain create my-brain
# 2. Activate it
brain use my-brain
# 3. Navigate to any project
cd ~/projects/my-app
# 4. Attach the project to your Brain
brain attach
# 5. Start working with any AI agent β they'll discover Brain automatically
# 6. When done, sync your Brain state
brain sync
# 7. Optionally, disconnect the workspace
brain detach
```
Run `brain` with no arguments to see system status at any time:
```
Brain Status
> Active Brain: my-brain
> Brain Path: C:\Users\you\brains\my-brain
> Attached Project: my-app
> Brain Version: v2
> Workspace Runtime: Connected
```
---
## Architecture
Brain consists of three distinct layers:
```
βββββββββββββββββββββββββββββββββββββββββββββββ
β Brain System (CLI) β β Management, lifecycle, protocol
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Brain Instance (~/brains/) β β Persistent cognition storage
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Workspace Runtime (.brain/) β β Local project bridge
βββββββββββββββββββββββββββββββββββββββββββββββ
```
### Brain Instance β Your Persistent Memory
Lives at `~/brains/<name>/`. This is the **source of truth** for all cognition.
```
my-brain/
βββ user/ # Your persistent identity
β βββ personality.md # Communication style & tone
β βββ preferences.md # Coding, architecture, tooling
β βββ workflows.md # Development habits & processes
β
βββ projects/ # Per-project memory
β βββ my-app/
β βββ context.md # Project overview & tech stack
β βββ architecture.md # System design & structure
β βββ decisions.md # Architecture decision records
β βββ tasks.md # Active, pending, completed tasks
β βββ handoff.md # Session continuity state
β βββ docs/ # Additional documentation
β βββ logs/ # Operational logs
β βββ agents/ # Per-agent project logs
β
βββ agent-configs/ # Agent discovery protocols
β βββ .cursorrules # Cursor auto-discovery
β βββ CLAUDE.md # Claude auto-discovery
β
βββ agents/ # Per-agent operational history
β βββ claude/
β βββ cursor/
β βββ codex/
β
βββ skills/ # Reusable workflow conventions
β βββ coding-style.md
β βββ debugging.md
β
βββ raw/ # Imported unstructured context
βββ versions/ # Sync snapshots (v1, v2, ...)
β βββ snapshot-1/
βββ AGENT.md # Brain protocol definition
```
### Workspace Runtime β The Bridge
The `.brain/` directory injected into your project is a **lightweight, disposable bridge** β not storage. It links agents to your Brain Instance.
```
project/.brain/
βββ AGENT.md # Generated workspace-specific protocol
βββ BRAIN.json # Machine-readable metadata
βββ linked_brain # Path to active Brain Instance
βββ current_project # Attached project identity
```
---
## CLI Reference
| Command | Description |
|---|---|
| `brain` | Show system status (default) |
| `brain create <name>` | Create a new Brain Instance at `~/brains/<name>/` |
| `brain use <name>` | Set the active Brain Instance globally |
| `brain import` | Inject `.brain/` runtime into the current workspace |
| `brain attach` | Register the workspace as a project in the active Brain (auto-imports if needed) |
| `brain sync` | Create a versioned snapshot of the current Brain state |
| `brain detach` | Remove the `.brain/` runtime from the workspace |
| `brain delete <name>` | Permanently delete a Brain Instance (`--force` to skip confirmation) |
| `brain status` | Display active brain, project, version, and runtime state |
| `brain connect` | *(Placeholder)* Future Supabase cloud sync integration |
### Examples
```bash
# Create and switch between multiple brains
brain create work-brain
brain create personal-brain
brain use work-brain
# Delete a brain you no longer need
brain delete personal-brain
# Check what's active
brain status
# Full workflow: attach, work, sync, detach
brain attach
# ... do your work with AI agents ...
brain sync
brain detach
```
---
## How It Works With AI Agents
Brain operates on a simple contract: **agents maintain Brain, Brain maintains continuity.**
### Agent Protocol
When an AI agent discovers `.brain/AGENT.md` in a workspace, it:
1. **Reads** user context from `user/` to understand your preferences
2. **Reads** project memory from `projects/<project>/` to resume continuity
3. **Follows** the handoff protocol: read handoff β work β update handoff
4. **Records** architecture decisions in `decisions.md`
5. **Updates** `tasks.md` as work progresses
6. **Writes** session logs to `agents/<agent-name>/`
### Auto-Discovery
Agents discover Brain automatically through standard configuration files:
- **Cursor** β reads `.cursorrules` β finds `.brain/`
- **Claude** β reads `CLAUDE.md` β finds `.brain/`
- **Others** β discovers `.brain/AGENT.md` in workspace root
No manual prompting required. Agents self-identify and operate within their own directories by convention.
---
## Core Design Principles
| Principle | Implementation |
|---|---|
| **Persistent Continuity** | Brain persists independently of projects, sessions, and tools |
| **Agents Maintain Brain** | AI agents read/write cognition; users just work normally |
| **Markdown Is The Protocol** | Everything is markdown, filesystem-based, git-compatible |
| **Local-First Ownership** | Fully local, user-owned, inspectable, and portable |
| **Convention Over Configuration** | Agents self-identify; no runtime enforcement needed |
---
## Tech Stack
| Component | Technology |
|---|---|
| Language | Python 3.11+ |
| CLI Framework | [Typer](https://typer.tiangolo.com/) |
| Terminal Rendering | [Rich](https://rich.readthedocs.io/) |
| Storage | Markdown (filesystem) |
| Versioning | Local snapshots (`shutil.copytree`) |
| Config | JSON (`~/.brainconfig`) |
| Packaging | `pyproject.toml` + `pip install -e .` |
---
## Project Structure
```
brain-base/
βββ pyproject.toml # Package config & dependencies
βββ README.md
βββ brain/
β βββ __init__.py
β βββ cli.py # Typer app + command registration
β βββ config.py # Global config (~/.brainconfig)
β βββ paths.py # Cross-platform path resolution
β βββ commands/
β β βββ create.py # brain create <name>
β β βββ use.py # brain use <name>
β β βββ status.py # brain status
β β βββ import_brain.py # brain import
β β βββ attach.py # brain attach
β β βββ sync.py # brain sync
β β βββ detach.py # brain detach
β β βββ delete.py # brain delete <name>
β β βββ connect.py # brain connect (placeholder)
β βββ templates/
β β βββ brain_instance.py # Brain Instance scaffolding
β β βββ project_memory.py # Project memory templates
β β βββ workspace_runtime.py # .brain/ runtime generation
β β βββ agent_protocol.py # AGENT.md generation
β βββ utils/
β βββ git.py # Git remote/identity detection
β βββ display.py # Rich console helpers
βββ creationdoc/ # Design documents & specifications
```
---
## Roadmap
- [x] Core CLI (`create`, `use`, `status`, `import`, `attach`, `sync`, `detach`)
- [x] Brain Instance scaffolding with templates
- [x] Workspace runtime bridge
- [x] Project memory with auto-detection (git remote β folder name β cwd)
- [x] Local version snapshots
- [x] `brain delete` with confirmation
- [ ] Supabase cloud sync (`brain connect` β placeholder exists)
- [ ] Cross-device synchronization
- [ ] Team collaboration & shared brains
- [ ] Brain export/import between machines
- [ ] Plugin system for custom agent protocols
---
## Philosophy
> The intelligence comes from the agents. The continuity comes from Brain.
Brain doesn't replace your AI tools. It makes them **coherent**. Every agent you use β Claude, Cursor, Copilot, Codex β reads from the same persistent memory and writes back to it. Context is never lost. Decisions are never forgotten. Handoffs happen automatically.
Your Brain is yours. It's markdown files on your filesystem. No vendor owns it. No cloud stores it. No subscription gates it. You can read it, edit it, version it with git, and carry it anywhere.
---
## License
Open Source. See [LICENSE](LICENSE) for details.
|