Spaces:
Sleeping
Sleeping
File size: 6,663 Bytes
a5d1c1b 61b1da1 a5d1c1b 61b1da1 a5d1c1b 61b1da1 a5d1c1b 61b1da1 a5d1c1b 61b1da1 a5d1c1b 61b1da1 a5d1c1b 61b1da1 a5d1c1b 61b1da1 a5d1c1b 61b1da1 a5d1c1b 61b1da1 7d25abb 61b1da1 7d25abb 61b1da1 7d25abb 48c866a 7d25abb 61b1da1 7d25abb 61b1da1 7d25abb 61b1da1 7d25abb 61b1da1 7d25abb | 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 | # Wiki: 05. CLI Specification & Workflows
The **Ever-Brain CLI** (`packages/cli` / `evb`) is the developer and AI agent control plane for the Ever-Brain project intelligence layer. It connects workspaces to Ever-Brain sources, manages local caches, auto-bootstraps agent meta-skills, materializes runbooks into agent directories, and provides Read & Write collaboration via GitHub's native RBAC.
---
## 1. Zero SQLite & Pure Filesystem Architecture
All local configuration and state is plain human- and agent-readable YAML:
```text
my-project/
βββ .evb/
β βββ config.yaml # Project binding (remote repo & branch)
β βββ state.yaml # Last sync timestamps, baseline source hashes (gitignored)
β βββ auth.yaml # Optional local credentials / token profile (gitignored)
β βββ cache/ # Local working mirror of knowledge/skills (gitignored)
β βββ knowledge/
β β βββ architecture.md
β β βββ conventions.md
β βββ skills/
β βββ testing/
β β βββ SKILL.md
β βββ api-design/
β βββ SKILL.md
βββ .agents/skills/ever-brain/
β βββ SKILL.md # Auto-bootstrapped Ever-Brain Meta-Skill for Agent
βββ .gitignore # Contains .evb/cache/, .evb/state.yaml, .evb/auth.yaml
```
---
## 2. Agent-First Ergonomics & Meta-Skill Bootstrapping
When `evb init` is executed, it automatically generates and installs the **`ever-brain` meta-skill** into:
- **Antigravity / Universal Standard**: `.agents/skills/ever-brain/SKILL.md` & `AGENTS.md`
- **Gemini**: `.gemini/skills/ever-brain/SKILL.md`
- **Cursor**: `.cursor/rules/ever-brain.mdc`
- **Claude Code**: `.claude/skills/ever-brain/SKILL.md`
This equips local AI agents to autonomously discover, read, update, push, and propose intelligence whenever the developer asks questions like:
- *"What's our rule on password hashing?"*
- *"Update the deployment runbook with the Redis timeout fix."*
- *"Propose a new skill for Docker Compose."*
---
## 3. GitHub Native RBAC (Read & Write Collaboration)
```text
Developer / AI Agent
β
ββββββββββββββ΄βββββββββββββ
βΌ βΌ
[Has Write Access] [Read-Only / Needs Review]
β β
βΌ βΌ
evb push evb propose
β β
Direct Commit Branch + Pull Request
β β
βΌ βΌ
GitHub Target Branch GitHub PR Review UI
```
### A. Direct Commit (`evb push`)
- Used by maintainers and collaborators with `write` or `admin` access.
- Uses GitHub Git Data API to create a multi-file commit directly on the target branch.
- Updates `state.yaml` baseline immediately upon commit creation.
### B. Pull Request Proposal (`evb propose`)
- Used by contributors or when teams enforce Pull Request reviews.
- Checks user write access; automatically creates a user fork if no direct branch-creation permission exists on upstream.
- Creates a proposal branch, pushes changes, and opens a GitHub Pull Request with a clickable review URL.
---
## 4. Local Modification Tracking & Collision Protection
1. **Dirty State Detection**:
- Compares local file SHA-256 hashes against `state.yaml` baseline hashes.
- Categorizes changes into `M` (modified), `A` (added), and `D` (deleted).
2. **Unified Diffing (`evb diff`)**:
- Emits raw unified diffs (`PAGER=cat` / `--json`) comparing local cached files with remote baseline text.
3. **Collision Protection**:
- `evb sync` checks if local modifications exist before overwriting cache. If dirty, sync halts with an actionable warning unless `--force` is supplied.
4. **Reset (`evb reset`)**:
- Discards uncommitted modifications and restores the remote baseline.
---
## 5. Command Reference
| Command | Description |
| :--- | :--- |
| `evb init [repoUrl]` | Connects workspace, creates config, syncs cache, and bootstraps agent meta-skill |
| `evb sync` | Synchronizes remote intelligence into local cache (collision protected) |
| `evb status` | Shows workspace connection, cache volume, and uncommitted modifications |
| `evb diff [path]` | Shows unified diff of local uncommitted modifications against baseline |
| `evb reset` | Discards local uncommitted modifications, restoring clean remote baseline |
| `evb push` | Directly commits local modifications to remote repository (write collaborators) |
| `evb propose` | Creates a proposal branch and opens a GitHub PR for team review |
| `evb auth login` | Authenticates with GitHub via PAT or GitHub CLI (explicit choice prompt) |
| `evb auth status` | Checks current GitHub authentication status and repository access level |
| `evb auth logout` | Clears stored GitHub authentication credentials |
| `evb knowledge list` | Lists all cached knowledge documents |
| `evb knowledge show <path>` | Displays content of a knowledge document |
| `evb skills list` | Lists all available project skills |
| `evb skills show <id>` | Renders a skill runbook in the terminal |
| `evb skills install <id>` | Materializes canonical skill into agent-native directories |
---
## 6. End-to-End Workflow: Using Ever-Brain on Any Local Workspace
Developers can attach Ever-Brain to any existing project on their machine:
1. **Globally Link CLI**:
```bash
pnpm cli:link
```
*(Or run `pnpm evb` directly inside the monorepo root).*
2. **Ensure API is running**:
```bash
pnpm dev:api
```
3. **Navigate to external workspace**:
```bash
cd ~/my-other-project # or C:\Projects\MyOtherApp
```
4. **Initialize Ever-Brain connection**:
```bash
evb init https://github.com/spencerpauly/skills-repo
```
5. **Observe automatic bootstrapping**:
- Meta-skill `.agents/skills/ever-brain/SKILL.md` (and `.gemini/skills/ever-brain/` / `.cursor/rules/ever-brain.mdc` / `.claude/skills/ever-brain/`) is written.
- Remote skills and knowledge are cached in `.evb/cache/`.
- Your local agent immediately has access to search, list, and materialize skills for that workspace.
|