File size: 12,267 Bytes
c662877
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# FELON Cortex β€” Local Cognitive Runtime

<p align="center">
  <img src="https://img.shields.io/badge/version-1.0.0-blue?style=flat-square" alt="Version">
  <img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License">
  <img src="https://img.shields.io/badge/python-3.10+-blue?style=flat-square" alt="Python">
  <img src="https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20android-lightgrey?style=flat-square" alt="Platform">
  <img src="https://img.shields.io/badge/privacy-100%25%20local-purple?style=flat-square" alt="Privacy">
  <img src="https://img.shields.io/badge/offline-ready-orange?style=flat-square" alt="Offline">
</p>

**Give ANY AI model a brain.** Memory. Knowledge. Tools. Verification. Confidence. All running locally. No cloud. No API keys required. Works offline.

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FELON CORTEX                          β”‚
β”‚                                                          β”‚
β”‚   You ──→  FELON  ──→  Claude / OpenAI / opencode /     β”‚
β”‚                         any local model                  β”‚
β”‚                                                          β”‚
β”‚   FELON wraps EVERY interaction with:                   β”‚
β”‚   🧬 DNA Memory     β†’ Never forgets                     β”‚
β”‚   πŸ“š Knowledge Lib   β†’ 22 SE textbooks                  β”‚
β”‚   πŸ” Veritas        β†’ 6 security + syntax checks        β”‚
β”‚   πŸ€– Nanobot Swarm  β†’ 8 local tools                     β”‚
β”‚   🎯 Confidence     β†’ Tells you when it's guessing      β”‚
β”‚   πŸ“ Session Journal β†’ Works offline, syncs later       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## What It Solves

| Problem | FELON Solution |
|---------|---------------|
| **AI forgets between sessions** | DNA Memory persists everything β€” picks up where you left off |
| **Can't code without internet** | Offline mode β€” local model + 22 textbooks + cached knowledge |
| **Models lie confidently** | Confidence score on every response: "I'm sure" / "experimental" / "guessing" |
| **No code verification** | Veritas runs 6 checks: syntax, security, imports, logic, tests, edge cases |
| **Blank slate every chat** | 22 SE textbooks injected into context automatically |
| **API downtime = dead project** | Session journal records everything offline, syncs when internet returns |

---

## Install

```bash
git clone https://github.com/AnonymousNomad/felon-cortex.git
cd felon-cortex
./install.sh
```

Or via pip:

```bash
pip install felon-cortex
```

Dependencies: **Python 3.10+ only.** Zero external packages required for core operation.

---

## Usage

```bash
felon start                    # Start proxy on http://localhost:8080
felon start --port 9090       # Custom port
felon status                   # View memory, sessions, knowledge
felon sync                     # Upload offline sessions when internet returns
```

Then point **any tool** at `http://localhost:8080`:

| Tool | Configuration |
|------|--------------|
| **Claude Desktop** | Settings β†’ Proxy β†’ `http://localhost:8080` |
| **opencode** | `--api-base http://localhost:8080` |
| **Continue.dev** | `apiBase: "http://localhost:8080"` in config |
| **Any OpenAI client** | Set `OPENAI_BASE_URL=http://localhost:8080` |
| **Local GGUF model** | `felon start --model ./my-model.gguf` |

---

## Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FELON CORTEX                           β”‚
β”‚                                                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
β”‚  β”‚   DNA    β”‚  β”‚ KNOWLEDGEβ”‚  β”‚ VERITAS  β”‚               β”‚
β”‚  β”‚  MEMORY  β”‚  β”‚ LIBRARY  β”‚  β”‚ 6-CHECK  β”‚               β”‚
β”‚  β”‚          β”‚  β”‚ 22 books β”‚  β”‚ VERIFIER β”‚               β”‚
β”‚  β”‚ Remembersβ”‚  β”‚ Works    β”‚  β”‚ Catches  β”‚               β”‚
β”‚  β”‚ every    β”‚  β”‚ offline  β”‚  β”‚ mistakes β”‚               β”‚
β”‚  β”‚ session  β”‚  β”‚          β”‚  β”‚          β”‚               β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜               β”‚
β”‚       β”‚              β”‚             β”‚                     β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β”‚                      β”‚                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚            PROMPT ENRICHMENT            β”‚              β”‚
β”‚  β”‚  Memory context + Knowledge + Context   β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                      β”‚                                   β”‚
β”‚                      β–Ό                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚           TARGET MODEL                  β”‚              β”‚
β”‚  β”‚  Claude / OpenAI / opencode / local    β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                      β”‚                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚         RESPONSE PROCESSING             β”‚              β”‚
β”‚  β”‚  Veritas checks + Confidence scoring    β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                      β”‚                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚  πŸ€– NANOBOT SWARM (8 tools)            β”‚              β”‚
β”‚  β”‚  fs β€’ git β€’ compile β€’ test β€’ search    β”‚              β”‚
β”‚  β”‚  shell β€’ library β€’ web_search          β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                      β”‚                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚  πŸ“ SESSION JOURNAL                     β”‚              β”‚
β”‚  β”‚  Offline β†’ logs β†’ syncs when online    β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                      β”‚                                   β”‚
β”‚                      β–Ό                                   β”‚
β”‚              VERIFIED + SCORED + TOOL-EXECUTED OUTPUT    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## Offline Mode

When the API is unreachable, FELON Cortex:

1. **DNA Memory** β€” pulls from past sessions (continuity)
2. **Knowledge Library** β€” answers from 22 SE textbooks
3. **Local Model** β€” falls back to bundled GGUF model (optional)
4. **Session Journal** β€” records every prompt, decision, file change
5. **Auto-Sync** β€” when internet returns, uploads journal β†’ model is instantly caught up

```
No internet?
  βœ“ You keep coding
  βœ“ FELON remembers everything
  βœ“ Knowledge library fills gaps
  βœ“ When internet returns: one sync β†’ model caught up
```

---

## Sub-Systems

### 🧬 DNA Memory

BM25-ranked retrieval across all past sessions. Gives the model continuity.
```python
# FELON automatically adds to every prompt:
[FELON DNA MEMORY β€” relevant context from past sessions]
Past interactions:
  (0.87) "Build REST API with Flask" β†’ "Use Flask blueprints for modular routes..."
  (0.72) "Add JWT auth" β†’ "Use flask-jwt-extended with token refresh..."
[END MEMORY]
```

### πŸ“š Knowledge Library

22 software engineering textbook entries. Topics: Python, algorithms, data structures, testing, git, security, design patterns, web, concurrency. BM25 retrieval with tag-based boosting. Works completely offline.

### πŸ” Veritas (6-Check Verifier)

Every code block in every response gets checked:
1. **Syntax** β€” `compile()` check
2. **Imports** β€” resolves every import
3. **Security** β€” blocks eval, exec, subprocess, pickle
4. **Logic** β€” has def/class/return/control flow
5. **Tests** β€” has assert statements
6. **Edge Cases** β€” has try/except or if/else

### 🎯 Confidence Scoring

Every response gets a confidence label:
- **βœ… 90%+** β€” High confidence, I'm sure
- **πŸ“Š 70-89%** β€” Moderate confidence
- **πŸ”¬ 50-69%** β€” Experimental, verify
- **⚠️ 30-49%** β€” Low confidence, I'm guessing
- **🚫 <30%** β€” I have no idea

### πŸ€– Nanobot Swarm

8 local tools the model can use:
| Tool | Actions |
|------|---------|
| `fs` | read, write, list, exists, delete, mkdir |
| `git` | init, add, commit, status, diff, log |
| `compile` | Syntax-check any Python file |
| `test` | Run pytest on any directory |
| `search` | Search codebase for patterns |
| `shell` | Run safe shell commands |
| `library` | Query knowledge library |
| `web_search` | Search allowlisted sites (docs.python.org, stackoverflow, etc.) |

### πŸ“ Session Journal

- Records every interaction during offline sessions
- Tracks: prompts, responses, decisions, file changes, tool use
- Builds sync summary when internet returns
- Model instantly catches up on everything that happened offline

---

## Benchmarks

| Metric | Value |
|--------|:-----:|
| Prompt enrichment latency | < 50ms |
| DNA Memory retrieval | < 10ms (BM25) |
| Knowledge Library query | < 5ms |
| Veritas 6-check | < 20ms per code block |
| Offline fallback latency | < 100ms |
| Memory: 1000 sessions stored | < 5MB disk |

---

## Development

```bash
git clone https://github.com/AnonymousNomad/felon-cortex.git
cd felon-cortex
pip install -e .

# Run tests
python -m pytest tests/

# Start dev proxy
felon start --port 8080
```

---

## Roadmap

- [x] DNA Memory (BM25 retrieval)
- [x] Knowledge Library (22 textbooks)
- [x] Veritas 6-check verifier
- [x] Nanobot swarm (8 tools)
- [x] Confidence scoring
- [x] Offline session journaling
- [x] Auto-sync on internet restore
- [ ] Bundled local GGUF model
- [ ] ChromaDB/FAISS for large-scale memory
- [ ] Web dashboard
- [ ] VSCode extension
- [ ] Multi-user memory isolation

---

## Project Status

**Beta β€” actively developed.** The core proxy, memory, knowledge library, and veritas layer are built and tested. Nanobot tools and offline sync are functional. Currently expanding the knowledge library and adding bundled local model support.

---

## Author

**FerrellSyntheticIntelligence (James Ferrell)** β€” built on a tablet with zero VC funding.

- GitHub: [AnonymousNomad](https://github.com/AnonymousNomad)
- HuggingFace: [FerrellSyntheticIntelligence](https://huggingface.co/FerrellSyntheticIntelligence)

---

## License

MIT License β€” free for personal and commercial use.

---

<p align="center">
  <b>FELON Cortex</b> β€” <i>Every model deserves a brain.</i>
</p>