|
1 | 1 | # Soulfield OS |
2 | 2 |
|
3 | | -A backend‑first agent OS for research → gap analysis → spec → (safe) execution. It exposes a minimal HTTP API, a read‑only MCP filesystem tool, a terminal spec browser, and adapters for Claude (Aiden), Jina rerank, InfraNodus gap analysis, and a policy‑first scraper. |
4 | | - |
5 | | -## Features |
6 | | -- API server: `/health`, `/chat` with “!” command router and `@agent` council routing. |
7 | | -- Agents: Aiden (Claude), Jina (semantic rerank), InfraNodus (gap analysis), Scraper (allowlist only). |
8 | | -- Memory: File memory by default; optional Pinecone with OpenAI embeddings. |
9 | | -- Compliance: TruthLens shim wraps outputs; scraper domain allowlist; read‑only MCP filesystem server. |
10 | | -- TUI: Terminal UI to browse/edit specs in `.agent-os/specs/*/spec.md`. |
11 | | -- Safe execution: `!coder-apply` executes only whitelisted commands from approved spec sections. |
12 | | -- Research enhancements: Bright Data templates (e.g., `google/serp`, `ebay/search`) and a discovery adapter (multi‑engine + BD SERP) to broaden coverage while staying policy‑first. |
13 | | - |
14 | | -## Quickstart |
15 | | -- Requirements: Node.js 18+ (20+ recommended). Create `.env` (see below). Do not commit real keys. |
16 | | -- Install: `npm install` |
17 | | -- Start API: `npm start` |
18 | | - - Health: `curl -s http://127.0.0.1:8790/health` |
19 | | - - Help: `curl -s -X POST http://127.0.0.1:8790/chat -H 'content-type: application/json' -d '{"prompt":"!help"}'` |
20 | | - - Aiden: `curl -s -X POST http://127.0.0.1:8790/chat -H 'content-type: application/json' -d '{"prompt":"@aiden: Summarize the workspace goals"}'` |
21 | | -- MCP (read‑only FS): `npm run start:mcp` |
22 | | - - Tools: GET `http://127.0.0.1:8791/mcp/tools` |
23 | | - - Call: POST `http://127.0.0.1:8791/mcp/call` `{ "name":"list_dir", "args": {"path":"workspace"} }` |
24 | | -- Spec TUI: `npm run start:tui` |
25 | | -- Spec apply tests: `npm run test:apply` (dry) or `npm run test:apply:run` (execute whitelisted commands) |
26 | | - |
27 | | -## Environment |
28 | | -Set in `.env`: |
29 | | -- Claude: `CLAUDE_API_KEY`, `AIDEN_MODEL` |
30 | | -- Jina: `JINA_API_KEY`, `JINA_MODEL` |
31 | | -- Pinecone (optional): `USE_PINECONE=1`, `PINECONE_API_KEY`, `PINECONE_INDEX` |
32 | | -- OpenAI Embeddings (if Pinecone): `OPENAI_API_KEY` |
33 | | -- InfraNodus: `INFRANODUS_API_KEY`, `INFRANODUS_API_BASE` |
34 | | -- Bright Data (optional): `BRIGHTDATA_TOKEN`, `BD_BASE_URL=https://api.brightdata.com`, `BD_TIMEOUT_MS=30000` |
35 | | - |
36 | | -## Commands (via /chat) |
37 | | -- `!help` – menu |
38 | | -- `!note <text> #tags` / `!recall #tag` – capture/recall |
39 | | -- `!plan-add active|future "Name" #tags` / `!plan-list` – roadmap |
40 | | -- `!golden "desc" #tags` / `!golden-list [#tag] [N]` – golden ideas |
41 | | -- `!session-note "text" #tags` / `!session-list [#tag] [N]` – session timeline |
42 | | -- `!learn <text> #tags` / `!knowledge-list [#tag] [N]` – knowledge |
43 | | -- `!learn-file <relative/path> [#tags]` – ingest file |
44 | | -- `!coder-apply [--spec <id>] [#apply]` – safe execute from latest/given spec |
45 | | - |
46 | | -CLI (local) |
47 | | -- `tools/sf specify` – generate spec from newest research |
48 | | -- `tools/sf specify:infra [exports/<file>.json]` – generate spec from InfraNodus export |
49 | | -- `tools/sf dry` / `tools/sf apply --apply` – safe preview/execute Run blocks |
50 | | -- `tools/sf search "<query>"` (planned) – discovery via multiple engines + Bright Data SERP → `workspace/data/search/*.jsonl` |
51 | | - |
52 | | -## Paths and Data |
53 | | -- API: `backend/index.cjs` |
54 | | -- Jobs: `backend/jobs.js` |
55 | | -- Council: `backend/council.js` |
56 | | -- Memory (file): `memory.js` → `data/memory.json` |
57 | | -- Memory (Pinecone): `backend/services/memory/memory-pinecone.cjs` |
58 | | -- Scraper: `backend/services/scraper/index.cjs` → `workspace/data/scrapes/*.jsonl` |
59 | | -- Specs: `backend/.agent-os/specs/<id>/spec.md` |
60 | | -- Apply logs: `backend/.agent-os/runs/*.log` |
61 | | -- MCP: `backend/mcp-server.cjs` |
62 | | -- TUI: `backend/tui.js` |
63 | | - |
64 | | -## Security & Compliance |
65 | | -- TruthLens wraps outputs (see `backend/truthLens.js` / `truthlens.cjs`). |
66 | | -- Scraper requires allowlist (`backend/services/scraper/config/allowlist.yaml`) using template tokens (e.g., `bd:google/serp`), tiered domains (gov, marketplaces, media, vendor_docs), bounded wildcards, and purpose tags. |
67 | | -- MCP is read-only and jailed to project root. |
68 | | -- `!coder-apply` whitelists basic commands only (`echo`, `ls`, `cat`, `head`). |
69 | | - |
70 | | -## CI / Truth Kernel (non-bypassable) |
71 | | -- Workflow: `.github/workflows/truth-kernel.yml` runs on pushes and PRs. |
72 | | -- Environment: Ubuntu, Node.js 20 (matches local stack). |
73 | | -- Steps: |
74 | | - 1. `npm ci` |
75 | | - 2. `node backend/scripts/audit-truth.cjs` |
76 | | - 3. `npm test` ← runs Node’s built-in test runner (`node:test`) against `backend/tests/*.test.cjs` |
77 | | -- If any step fails, the merge is blocked. This ensures only TruthLens-compliant, non-simulation, and tested changes land on `main`. |
78 | | - |
79 | | -## Using Codex (file-based prompt) |
80 | | -- Canonical runbook lives at `.agent-os/instructions/core/codex-runbook.md`. |
81 | | -- Invoke Codex with a file-based system prompt flag (example): |
82 | | - ```bash |
83 | | - codex run --prompt-file .agent-os/instructions/core/codex-runbook.md |
84 | | - ``` |
85 | | -- Aurea outputs PLAN → DIFFS → COMMANDS → TESTS → VERIFICATION → ROLLBACK; Codex applies the diffs and pushes per the runbook. |
86 | | - |
87 | | -## Known Issues / Notes |
88 | | -- Rotate any real API keys in `.env` before sharing. |
89 | | -- InfraNodus client stubs queue requests offline; integrate the real API when keys are set. |
90 | | -- Pinecone path is optional; with `USE_PINECONE!=1`, the system uses file memory. |
91 | | -- Bright Data integration is template‑based; do not enable all categories by default. |
92 | | - |
93 | | -## Soulfield OS — Docs Zone |
94 | | - |
95 | | -## TruthLens (runtime + repo gate) |
96 | | -All assistant and agent outputs are wrapped by TruthLens at runtime, enforcing structural clarity and non-simulation. The canonical shim lives at `truthLens.js`; the backend module is `backend/truthlens.cjs`. |
97 | | - |
98 | | -Repo hard-gate: CI (`.github/workflows/truth-kernel.yml`) blocks merges unless the Truth audit and tests pass. The audit script validates that generated artifacts either: |
99 | | -- contain `meta.lens.passed` with `"structure"` when JSON, or |
100 | | -- contain no simulation phrases in prose (code blocks are ignored). |
101 | | - |
102 | | -Run locally: |
| 3 | +> The AI Business OS That Doesn’t Hallucinate |
| 4 | +> Orchestrates research → strategy → execution → analytics, all gated by TruthLens. |
| 5 | +
|
| 6 | +--- |
| 7 | + |
| 8 | +## ✨ What It Is |
| 9 | +Soulfield OS is a backend-first orchestration system where: |
| 10 | +- Aiden (Claude) turns research into specs. |
| 11 | +- InfraNodus identifies content/market gaps. |
| 12 | +- Bright Data Scraper fetches compliant marketplace/search data (allowlist enforced). |
| 13 | +- Jina reranks and semantically searches across workspace docs. |
| 14 | +- TruthLens checkpoints every step, blocking simulation, hallucinations, or invalid metrics. |
| 15 | + |
| 16 | +Outputs: trusted, auditable business blueprints. |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## 🚀 Quickstart |
| 21 | + |
103 | 22 | ```bash |
| 23 | +git clone https://github.com/mrhpython/Soulfield |
| 24 | +cd Soulfield |
104 | 25 | npm ci |
105 | | -node backend/scripts/audit-truth.cjs |
106 | | -npm test |
| 26 | + |
| 27 | +# Research loop |
| 28 | +sf research "eco-friendly digital planners UK" |
| 29 | +sf specify |
| 30 | +sf index |
| 31 | +sf dry |
| 32 | +sf apply --apply |
107 | 33 | ``` |
108 | 34 |
|
109 | | -Policy source of truth: `workspace/knowledge/TruthLens.md`. |
| 35 | +--- |
110 | 36 |
|
111 | | -## Codex-first workflow |
112 | | -We prefer plans → diffs → commands → tests → verification → rollback. Codex applies patches and pushes. See runbook: |
113 | | -``` |
114 | | -.agent-os/instructions/core/codex-runbook.md |
115 | | -``` |
| 37 | +## 🛡️ Compliance |
| 38 | +- Default jurisdiction: UK, currency GBP. |
| 39 | +- Online-first businesses only. |
| 40 | +- Scraping only from allowlisted templates/domains (`backend/services/scraper/config/allowlist.yaml`). |
| 41 | +- No login-wall, PII, or policy-violating sources. |
| 42 | +- TruthLens audit enforced in CI: `node backend/scripts/audit-truth.cjs`. |
| 43 | + |
| 44 | +--- |
116 | 45 |
|
117 | | -## Quick links |
118 | | -- Runtime lens: `truthLens.js`, `backend/truthlens.cjs` |
119 | | -- Audit script: `backend/scripts/audit-truth.cjs` |
120 | | -- Tests: `backend/tests/*.test.cjs` (Node’s built-in `node:test`) |
121 | | -- Ops status & commands: `workspace/docs/STATUS.md` |
| 46 | +## 📚 Docs |
| 47 | +- [Design Intent](workspace/docs/Soulfield%20OS%20Design%20Intent.md) |
| 48 | +- [STATUS.md](workspace/docs/STATUS.md) |
| 49 | +- [TruthLens Policy](workspace/knowledge/TruthLens.md) |
| 50 | +- [TruthLens Vision](workspace/knowledge/TruthLens-Vision.md) |
122 | 51 |
|
123 | | -## License |
124 | | -See repository terms or your organization policy. No license header added by default. |
125 | | -### Local testing (Ubuntu) |
126 | | -- Run all unit tests: `npm test` |
127 | | -- Run the Truth audit only: `node backend/scripts/audit-truth.cjs` |
| 52 | +--- |
128 | 53 |
|
129 | | -## PR Titles/Bodies — Docs Zone |
| 54 | +## 🛠️ Development |
| 55 | +- Node.js ≥20 |
| 56 | +- CLI helper: `sf` (research/specify/apply/log) |
| 57 | +- CI: TruthKernel audit + Node/Python checks |
| 58 | +- Codex workflow: PLAN → DIFFS → COMMANDS → TESTS → VERIFICATION → ROLLBACK |
130 | 59 |
|
131 | | -- **Merge Runbook + Helper Reapply** |
132 | | - - Title: `docs: reapply merge runbook + helper scripts` |
133 | | - - Body: `Re-adds PR helper (tools/gh-pr-open-and-merge.cjs) and batch script (tools/merge-three-prs.sh), and marks the batch executable. No runtime changes.` |
134 | | - - Labels: `docs,tools` |
| 60 | +--- |
135 | 61 |
|
136 | | -> Always reuse these strings when reopening or reapplying the merge runbook/PR helper. Do not invent new wording — keeps history clean and consistent. |
| 62 | +## 📌 One-Liner |
| 63 | +Soulfield OS = orchestration hub. |
| 64 | +TruthLens = trust filter. |
| 65 | +Together → reliable AI business operations. |
0 commit comments