Skip to content

Commit 9a7eff2

Browse files
author
VoardWalker-Code
committed
feat: add MA, resource manager, bug tracker, smart ports, user guide
New features: - Memory Architect (MA) — full AI coding assistant with blueprints, knowledge base, skills, agent delegation, workspace project scaffolds - Resource Manager app — entity active resource tracking with task/project management - Bug Tracker app — screenshot capture, severity tracking, markdown report export - Smart port management — auto-detect conflicts, identify running instances, prompt before duplicates - /ma slash command bridge — server-to-server MA integration with auto-boot - Entity enrichment routes — personality and cognitive state endpoints - Process manager — start/stop/health-check for MA and sub-servers New docs: - USER-GUIDE.md — comprehensive 24-section NekoCore OS user guide - MA-AND-PROJECT-STRUCTURE.md — MA architecture and folder layout Infrastructure: - port-guard.js shared utility for all servers - kill-all.js and neko-start.js convenience scripts - MA workspace scaffolds (rem-system + nekocore) with build blueprints - Gitignore hardened for MA private data (API keys, memories, chat history) - Factory reset run for both NekoCore OS and MA — ships clean
1 parent 1e41c58 commit 9a7eff2

141 files changed

Lines changed: 21784 additions & 214 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,45 @@ project/server/data/nekocore-audit.ndjson
5757
project/skills/*/workspace/*
5858
!project/skills/*/workspace/.gitkeep
5959

60+
# MA private runtime data — never commit
61+
/project/MA/MA-Config/ma-config.json
62+
/project/MA/MA-Config/chat-history.json
63+
/project/MA/MA-Config/model-performance.json
64+
/project/MA/MA-Config/chores.json
65+
/project/MA/MA-entity/*/memories/
66+
/project/MA/MA-entity/*/index/
67+
/project/MA/MA-entity/*/archives/
68+
/project/MA/MA-entity/*/prompt-history/
69+
/project/MA/MA-logs/
70+
71+
# MA dev/debug temp scripts — not for distribution
72+
/project/MA/tmp-*.js
73+
/project/MA/_*.js
74+
/project/MA/test-*.js
75+
76+
# MA workspace projects — starter scaffolds are tracked (BUILD-ORDER.md, PROJECT-MANIFEST.json, package.json).
77+
# Everything MA builds inside these folders (source, tests, node_modules) is gitignored.
78+
# Only the scaffold files are committed — the rest is generated by MA at build time.
79+
/project/MA/MA-workspace/nekocore/node_modules/
80+
/project/MA/MA-workspace/nekocore/server/
81+
/project/MA/MA-workspace/nekocore/contracts/
82+
/project/MA/MA-workspace/nekocore/client/
83+
/project/MA/MA-workspace/nekocore/scripts/
84+
/project/MA/MA-workspace/nekocore/tests/
85+
/project/MA/MA-workspace/nekocore/nekocore-server.js
86+
/project/MA/MA-workspace/nekocore/nekocore-cli.js
87+
/project/MA/MA-workspace/nekocore/nekocore-start.js
88+
/project/MA/MA-workspace/rem-system/node_modules/
89+
/project/MA/MA-workspace/rem-system/server/
90+
/project/MA/MA-workspace/rem-system/contracts/
91+
/project/MA/MA-workspace/rem-system/client/
92+
/project/MA/MA-workspace/rem-system/config/
93+
/project/MA/MA-workspace/rem-system/entities/
94+
/project/MA/MA-workspace/rem-system/scripts/
95+
/project/MA/MA-workspace/rem-system/tests/
96+
/project/MA/MA-workspace/rem-system/rem-server.js
97+
/project/MA/MA-workspace/rem-system/rem-start.js
98+
6099
# Generated system repair script (build artifact from generate-fixer.js)
61100
project/neko_fixer.py
62101

CHANGELOG.md

Lines changed: 67 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ The brain loop ticks independently of conversation:
197197
198198
> **Layered cognition** — subconscious, dream-intuition, and conscious phases run in formation; parallel where it counts, sequential where it must.
199199
200-
> **Zero dependencies** — the entire runtime is pure Node.js. No vector database. No external SDKs. File-system JSON persistence.
200+
> **Zero dependencies** — the entire runtime is pure Node.js (no Express, no frameworks). No vector database. No external SDKs. File-system JSON persistence.
201201
202202
> **Open architecture** — every subsystem is observable via the SSE cognitive bus. Nothing the entity thinks is hidden from the developer.
203203
@@ -207,7 +207,7 @@ The brain loop ticks independently of conversation:
207207

208208
| Capability | Detail |
209209
|---|---|
210-
| **Runtime** | Pure Node.js 18+ — zero external runtime dependencies |
210+
| **Runtime** | Pure Node.js 18+ — zero external runtime dependencies (no Express) |
211211
| **Persistence** | File-system JSON — no database required |
212212
| **Memory types** | Episodic · Semantic · Long-Term (compressed chatlog chunks) |
213213
| **Pipeline phases** | 1A (subconscious) · 1D (dream) · 1C (conscious) · Final · Brain Loop |
@@ -335,7 +335,7 @@ npm install
335335
npm start
336336
```
337337

338-
Open `http://localhost:3000` in your browser.
338+
Open `http://localhost:3847` in your browser.
339339

340340
### Configure
341341

@@ -349,8 +349,7 @@ cp Config/ma-config.example.json Config/ma-config.json
349349
{
350350
"provider": "ollama",
351351
"ollamaBaseUrl": "http://localhost:11434",
352-
"defaultModel": "mistral",
353-
"port": 3000
352+
"defaultModel": "mistral"
354353
}
355354
```
356355

@@ -360,11 +359,12 @@ cp Config/ma-config.example.json Config/ma-config.json
360359
{
361360
"provider": "openrouter",
362361
"openRouterApiKey": "sk-or-...",
363-
"defaultModel": "mistralai/mistral-7b-instruct",
364-
"port": 3000
362+
"defaultModel": "mistralai/mistral-7b-instruct"
365363
}
366364
```
367365

366+
The server port (default 3847) is not set in the config file — it uses `PORT` environment variable or the built-in default. If the port is busy, the server identifies what's running and offers to start on the next available port.
367+
368368
### Recommended Multi-Phase Setup
369369

370370
Route each pipeline phase to a specialized model for best results:

WORKLOG.md

Lines changed: 583 additions & 4 deletions
Large diffs are not rendered by default.

docs/ARCHITECTURE-OVERVIEW.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# REM System — Architecture Overview
22

3-
Version: 0.9.0
4-
Last updated: 2026-03-18
3+
Version: 0.10.0
4+
Last updated: 2026-03-22
55

66
---
77

@@ -22,6 +22,12 @@ Phases 1–3 (bug fixes, refactor, modularization) are complete. Feature work is
2222
- **Phase 4.7 — Agent Echo: Multi-Index Archive + Retrieval Pipeline:** ✅ COMPLETE — Echo Now + Echo Past retrieval behavior integrated.
2323
- **Phase 4.8 — Pipeline Hardening + Modularization Completion:** ✅ COMPLETE.
2424
- **Phase 4.9 — Modular Task Orchestration Architecture (MTOA):** ✅ COMPLETE — task intent fork, context gatherer, executor/event bus, sessions/archive/project store, frontman bridge, task routes, entity-chat planning, and client task UI are live.
25+
- **Phase 4.10 — Entity Orchestration:** ✅ COMPLETE — multi-entity session API and planning infrastructure.
26+
- **OS Tool System Upgrade:** ✅ COMPLETE — three-pass JSON/Zod parser replaces regex, block format for file writes, structured result formatting.
27+
- **Entity Genesis Skill:** ✅ COMPLETE — MA-driven entity creation with iterative memory injection and cognitive ticking.
28+
- **MA Bridge:** ✅ COMPLETE — `/ma` slash command for server-to-server MA calls with auto-boot.
29+
- **Bug Tracker App:** ✅ COMPLETE — developer bug tracking with screenshots, JSON persistence, markdown reports.
30+
- **Resource Manager App:** ✅ COMPLETE — unified GUI for Todos, Pulses, Tasks, Projects, and Blueprints with CRUD, active-state toggling, and MA pulse proxy.
2531
- **Installer package baseline (pre-cleanup):** ✅ COMPLETE — strict marker-boundary installer/uninstaller, rollback guarantees, `JsonEntryId` targeting, and app payload file lifecycle (`create-file`, `delete-file`) validated with Hello World end-to-end.
2632
- **Phase 5 — Predictive Memory Topology:** next approved feature phase.
2733

@@ -63,6 +69,13 @@ Desktop shell, browser, and runtime stability work continues in parallel with Ph
6369
| **Skills** | skills/ | Pluggable tools (web search, file ops, memory tools) |
6470
| **SSE / Diagnostics** | server/routes/sse-routes.js | Real-time streaming diagnostics and cognitive bus events |
6571
| **Task UI (Client)** | client/js/apps/optional/task-ui.js, client/js/apps/core/chat.js, client/js/apps/core/telemetry-ui.js | Task badge/status in chat, task history/detail panel, Task Manager active-task telemetry |
72+
| **MA Bridge** | server/services/ma-bridge.js | Server-to-server calls to MA (port 3850) with auto-boot via process manager |
73+
| **Process Manager** | server/routes/process-manager-routes.js | Start/stop/health-check for MA, REM System, and NekoCore servers |
74+
| **Entity Enrichment** | server/routes/entity-enrichment-routes.js | Memory injection, cognitive tick, and state read for external builders (Entity Genesis) |
75+
| **Todo Store** | server/services/todo-store.js | Per-entity todo CRUD with atomic disk writes |
76+
| **Resource Active State** | server/services/resource-active-state.js | Tracks which todo/task/project/pulse is "active" per entity |
77+
| **Resource Manager Routes** | server/routes/resource-manager-routes.js | REST API for todos, tasks, projects, blueprints, MA pulse proxy, and active state |
78+
| **Bug Tracker (Client)** | client/apps/non-core/core/tab-bugtracker.html | Developer bug tracking app with screenshot capture and reporting |
6679

6780
---
6881

@@ -96,13 +109,20 @@ server/routes/
96109
task-routes.js — task run/session/cancel/modules/history API
97110
entity-chat-routes.js — planning/multi-entity chat session API
98111
entity-routes.js — entity CRUD, user profiles, relationships, guided/character creation
112+
entity-enrichment-routes.js — memory injection, cognitive tick, state read (Entity Genesis)
99113
memory-routes.js — memory read/write/search
100114
brain-routes.js — brain loop control
101115
cognitive-routes.js — sleep, dream, archive triggers
102116
document-routes.js — document ingestion pipeline
103117
config-routes.js — runtime config management
104118
sse-routes.js — real-time event streaming
105119
skills-routes.js — skill invocation surface
120+
browser-routes.js — embedded browser session management
121+
vfs-routes.js — virtual filesystem operations
122+
nekocore-routes.js — NekoCore OS system routes
123+
archive-routes.js — conversation archive management
124+
process-manager-routes.js — MA/REM/NekoCore server lifecycle
125+
resource-manager-routes.js — todos, tasks, projects, pulses, blueprints, active state
106126
```
107127

108128
---
@@ -117,6 +137,7 @@ entities/
117137
onboarding-state.json
118138
beliefs/ — belief graph persistence
119139
index/ — memory index files
140+
active-resources.json — tracks which todo/task/project/pulse is currently active
120141
memories/
121142
context.md — assembled LLM context (rebuilt on server start and memory update)
122143
system-prompt.txt — identity foundation and backstory
@@ -125,6 +146,7 @@ entities/
125146
episodic/ — episodic memory folders
126147
semantic/ — semantic knowledge folders
127148
ltm/ — long-term compressed chatlog chunks
149+
todos/ — per-entity todo items (todos.json)
128150
quarantine/
129151
skills/
130152
```
@@ -136,11 +158,15 @@ entities/
136158
| File | Contents |
137159
|------|----------|
138160
| ARCHITECTURE-OVERVIEW.md | This file — system map and design principles |
161+
| USER-GUIDE.md | Complete NekoCore OS user guide — desktop, apps, entities, chat, brain, memory, dreams, LLM setup |
162+
| MA-AND-PROJECT-STRUCTURE.md | MA's role, folder relationship, gitignored builds, sub-project history |
139163
| PIPELINE-AND-ORCHESTRATION.md | Cognitive pipeline, orchestrator, worker subsystem, escalation |
140164
| MEMORY-SYSTEM.md | All memory subsystems — storage, retrieval, decay, belief graph, topic archive, context assembly |
141165
| ENTITY-AND-IDENTITY.md | Entity creation, identity modes, voice profiles, context consolidation |
142166
| DREAM-SYSTEM.md | Dream intuition (live) and dream maintenance (offline sleep) |
143167
| CONTRACTS-AND-SCHEMAS.md | Memory schema, voice profile schema, worker output contract, contributor contracts |
144168
| MODEL-RECOMMENDATIONS.md | OpenRouter + Ollama model picks for each pipeline stage |
169+
| HOW-TO-CREATE-AN-APP.md | Step-by-step guide for building new NekoCore OS apps |
170+
| APP-FOLDER-OWNERSHIP.md | File ownership rules for client apps |
145171
| NEKOCORE-OS-WHITE-PAPER-v2.md | Technical white paper — architecture, philosophy, and benchmark results |
146172
| NEKOCORE-OS-ARCHITECTURE-v1.md | Deep technical reference — full subsystem coverage, file map, ADRs |

docs/MA-AND-PROJECT-STRUCTURE.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# MA and Project Structure
2+
3+
Version: 1.0.0
4+
Last updated: 2026-03-22
5+
6+
---
7+
8+
## Why MA Lives Inside the Project
9+
10+
**MA (Memory Architect)** is NekoCore OS's built-in AI development agent. It is not an external dependency — it is a first-class subsystem that lives at `project/MA/` and serves two roles:
11+
12+
1. **Builder** — MA's blueprints define the architecture for two sub-projects that can be built from scratch:
13+
- **REM System Core** (26 modules, 8 layers) — the cognitive memory engine at port 3860
14+
- **NekoCore Cognitive Mind** (97 modules, 5 parts) — the full cognitive personality runtime at port 3870
15+
16+
Starter scaffolds (PROJECT-MANIFEST.json, BUILD-ORDER.md, package.json) are included in the repo. MA builds the full implementation from the blueprints.
17+
18+
2. **Runtime service** — MA runs as a persistent background server (port 3850) that NekoCore OS entities can call for tool execution, web search, model routing, and recurring task management (pulses/chores). The OS server proxies requests to MA through the `/ma` slash command bridge and the Resource Manager's pulse panel.
19+
20+
### Folder Relationship
21+
22+
```
23+
project/
24+
├── server/ ← NekoCore OS server (port 3847)
25+
│ └── brain/ ← Cognitive pipeline, tasks, blueprints
26+
├── client/ ← OS GUI (desktop shell, apps, tabs)
27+
├── MA/ ← Memory Architect (port 3850)
28+
│ ├── MA-Server.js ← Self-contained Node.js server
29+
│ ├── MA-server/ ← 15 core modules (zero npm deps)
30+
│ ├── MA-workspace/ ← Sandboxed project workspace
31+
│ │ ├── nekocore/ ← Starter scaffold (MA builds from blueprints)
32+
│ │ └── rem-system/ ← Starter scaffold (MA builds from blueprints)
33+
│ ├── MA-blueprints/ ← Build instructions (tracked)
34+
│ ├── MA-knowledge/ ← Reference docs (tracked)
35+
│ └── MA-skills/ ← Skill definitions (tracked)
36+
├── entities/ ← [GITIGNORED] Runtime entity data
37+
└── memories/ ← [GITIGNORED] Runtime system memory
38+
```
39+
40+
MA itself (the engine, config templates, blueprints, skills, knowledge base) is **tracked in git**. The workspace projects include starter scaffolds (manifest, build order, package.json) that are tracked — everything MA builds from the blueprints (source code, tests, node_modules) is gitignored.
41+
42+
### How the Workspace Projects Work
43+
44+
The `nekocore/` and `rem-system/` workspace directories ship as **starter scaffolds** — just a PROJECT-MANIFEST.json (all statuses "not-started"), a BUILD-ORDER.md (construction guide), and a package.json. MA reads the blueprints (`MA-blueprints/nekocore/` and `MA-blueprints/rem-system/`) and builds the full implementation module-by-module, updating the manifest as it goes.
45+
46+
The generated source code, contracts, tests, client code, and node_modules are all gitignored. The blueprints remain tracked and serve as the authoritative build instructions.
47+
48+
---
49+
50+
## How MA Communicates With NekoCore OS
51+
52+
### Server-to-Server Bridge
53+
54+
NekoCore OS entities can call MA through the `/ma` slash command:
55+
56+
```
57+
User: /ma search for Node.js best practices
58+
```
59+
60+
The OS server (`server/services/ma-bridge.js`) handles this by:
61+
1. Checking if MA is running (health check on port 3850)
62+
2. Auto-booting MA via the process manager if offline
63+
3. Sending the message to `POST /api/chat` on MA
64+
4. Returning MA's response to the entity's conversation
65+
66+
### Pulse/Chore Proxy
67+
68+
The Resource Manager app proxies pulse and chore management through the OS server:
69+
70+
```
71+
Client → OS Server (port 3847) → MA Server (port 3850)
72+
GET /api/resources/pulses → GET /api/pulse/status + GET /api/chores/list
73+
POST /api/resources/pulses/chores → POST /api/chores/add
74+
POST /api/resources/pulses/:id/toggle → POST /api/pulse/start or /api/pulse/stop
75+
```
76+
77+
This keeps the client talking to a single origin (the OS server) while MA handles the recurring task engine internally.
78+
79+
### Process Management
80+
81+
The OS server can start, stop, and health-check both MA and the NekoCore Cognitive Mind server via the Process Manager routes:
82+
83+
| Route | Action |
84+
|-------|--------|
85+
| `GET /api/servers/status` | Health check all managed servers |
86+
| `POST /api/servers/:id/start` | Start MA or NekoCore server |
87+
| `POST /api/servers/:id/stop` | Stop a managed server |
88+
89+
Managed servers: `rem-system` (port 3860), `nekocore` (port 3870), and MA itself (port 3850).
90+
91+
---
92+
93+
## Sub-Project Build History
94+
95+
### REM System Core
96+
97+
- **Location:** `MA-workspace/rem-system/` (starter scaffold tracked; built source gitignored)
98+
- **Blueprint:** `MA-blueprints/rem-system/` (tracked)
99+
- **Scope:** 26 modules across 8 layers — memory storage, NLP, pipeline, entity identity, dream/brain loop, integration, transport, entity management
100+
- **Port:** 3860
101+
- **Purpose:** Standalone cognitive memory engine that can be embedded or run as a microservice
102+
103+
### NekoCore Cognitive Mind
104+
105+
- **Location:** `MA-workspace/nekocore/` (starter scaffold tracked; built source gitignored)
106+
- **Blueprint:** `MA-blueprints/nekocore/` (tracked)
107+
- **Scope:** 97 modules across 5 parts — Foundation, Memory+Knowledge, Cognition Engine, Identity+Generation, Services+Transport
108+
- **Port:** 3870
109+
- **Pre-requisite:** REM System must be running (port 3860)
110+
- **Purpose:** Full cognitive personality runtime — the reference implementation of a NekoCore entity mind as a standalone server
111+
112+
Both projects are built by MA following the blueprint-driven development workflow: plan → decompose → build module-by-module → test → integrate. The repo ships starter scaffolds; ask MA to build them.
113+
114+
---
115+
116+
## Building New Projects With MA
117+
118+
MA's workspace (`MA-workspace/`) is sandboxed — all file operations are restricted to this directory. To create a new project:
119+
120+
1. Write a blueprint in `MA-blueprints/` describing the architecture
121+
2. Start MA (`node MA-Server.js` or via Process Manager)
122+
3. Give MA the build instruction: `"Build the project following the blueprint at MA-blueprints/my-project/"`
123+
4. MA will create the project directory, scaffold modules, write tests, and iterate
124+
125+
The blueprint system supports both core blueprints (universal patterns like task decomposition, error recovery) and module-specific blueprints (research, code, writing, analysis, planning).
126+
127+
---
128+
129+
## Related Documents
130+
131+
| Document | What It Covers |
132+
|----------|---------------|
133+
| [ARCHITECTURE-OVERVIEW.md](ARCHITECTURE-OVERVIEW.md) | Full system map, subsystem table, design principles |
134+
| [PIPELINE-AND-ORCHESTRATION.md](PIPELINE-AND-ORCHESTRATION.md) | Cognitive pipeline, orchestrator, task fork |
135+
| [APP-FOLDER-OWNERSHIP.md](APP-FOLDER-OWNERSHIP.md) | File ownership rules for apps |
136+
| [HOW-TO-CREATE-AN-APP.md](HOW-TO-CREATE-AN-APP.md) | Step-by-step guide for new NekoCore OS apps |
137+
| `project/MA/README.md` | MA quick start, feature list, configuration |
138+
| `project/MA/USER-GUIDE.md` | Full MA user guide |

0 commit comments

Comments
 (0)