Skip to content

Commit b5db901

Browse files
author
Michael
committed
Resolve conflicts
2 parents 6e0ac3a + 8941db7 commit b5db901

2,217 files changed

Lines changed: 358715 additions & 1398 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.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SYSTEM UPDATE FOR AUREA — TRUTH-FIRST CODEX WORKFLOW (NON-BYPASSABLE)
2+
3+
**Scope:** Do not edit files directly. Output only: PLAN → DIFFS → COMMANDS → TESTS → VERIFICATION → ROLLBACK.
4+
5+
**Contracts to enforce:**
6+
- NON SIMULATION CONTRACT (no persona/emotion/trust simulation).
7+
- Truth-first engineering (separate DATA/REASONING/SPECULATION; surface contradictions; use ASSUMPTION when needed).
8+
- Rights & Safety: refuse unsafe or rights-violating actions; propose safe alternatives.
9+
10+
**Output format (always):**
11+
1. PLAN (≤8 steps, risks/unknowns)
12+
2. DIFFS (fenced ```diff blocks with correct paths)
13+
3. COMMANDS (Codex-executable shell lines incl. git)
14+
4. TESTS (unit/integration proving acceptance)
15+
5. VERIFICATION (local/CI checklist)
16+
6. ROLLBACK (safe revert)
17+
18+
**Determinism & Safety:**
19+
- Idempotent commands; no destructive ops without gating/dry-run.
20+
- Secrets via env vars only; `.env.example` updates if needed.
21+
- Explicit failure messages; halt on contradictions.
22+
23+
**Acceptance criteria:** Each task must define clear, testable bullets that would fail pre-change and pass post-change.
24+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# CODEX RUNBOOK — APPLY PATCHES WITH TRUTH KERNEL SAFETY
2+
3+
**Objective:** Apply Aurea’s DIFFS exactly; validate with audit + tests; commit and push.
4+
5+
## Steps (strict order)
6+
1) **Repo prep**
7+
- `git status --porcelain`
8+
- `git pull --rebase`
9+
- `git checkout -b feat/<slug> || git switch feat/<slug>`
10+
2) **Apply patches**
11+
- For each ```diff block from Aurea, apply using:
12+
- `git apply --index --reject` # fail on rejects
13+
- Ensure any new directories exist before apply.
14+
3) **Install & build**
15+
- `npm ci`
16+
- `npm run build || true` # only if a build script exists
17+
4) **Static checks & tests**
18+
- `npm test`
19+
- `node backend/scripts/audit-truth.cjs`
20+
5) **Dry-run and (if required) safe execute**
21+
- If `sf` exists: `sf dry` # never run `sf apply --apply` unless explicitly requested
22+
6) **Commit & push**
23+
- `git add -A`
24+
- `git commit -m "feat: <concise summary of change>"`
25+
- `git push -u origin HEAD`
26+
7) **PR**
27+
- Create PR titled `feat: <summary> (TruthKernel)`
28+
- PR body includes acceptance-criteria checklist and last audit/test outputs.
29+
30+
**Failure policy:** On ANY failure (apply/test/audit), stop and post the failing command, exit code, and last 120 lines of logs. No partial commits.
31+
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# PR Merge Runbook — Truth Kernel Branches
2+
3+
Purpose: deterministically open and merge our three current branches using either the GitHub UI or the repo’s helper script. This file is the canonical reference for future threads.
4+
5+
## Branches
6+
1. **PR 1** (audit fix) → `fix/audit-hyphenated-identifiers``main`
7+
2. **PR 2** (node test runner) → `test/node-runner``main`
8+
3. **PR 3** (docs) → `docs/truthlens-readme-status``main` (after rebasing on merged PR1+PR2)
9+
10+
---
11+
12+
## Option A — GitHub UI (simplest)
13+
1. Open each “Compare & pull request” link for the three branches.
14+
2. Titles/Bodies:
15+
- PR 1 — **Title:** `fix(audit): ignore code blocks; tighten pronoun detection`
16+
**Body:** Refines simulation detection to skip fenced/inline code and avoid hyphen/underscore-bound identifiers. Adds unit tests.
17+
- PR 2 — **Title:** `test: switch to Node built-in runner; convert audit tests`
18+
**Body:** Replaces Mocha semantics with node:test. Updates package.json test script. Ensures zero-deps test execution in CI.
19+
- PR 3 — **Title:** `docs: TruthLens runtime + audit; compliance quick checks; Codex workflow`
20+
**Body:** README adds TruthLens + CI gate overview; STATUS adds compliance quick checks; TruthLens policy page gains canonical pointers.
21+
3. Labels:
22+
- PR 1: `truth-kernel`, `audit`
23+
- PR 2: `tests`, `truth-kernel`
24+
- PR 3: `docs`, `truth-kernel`
25+
4. Merge order:
26+
- Merge PR 1 → Merge PR 2 → Rebase `docs/truthlens-readme-status` on `main`, then open & merge PR 3.
27+
28+
---
29+
30+
## Option B — Helper script (no gh CLI)
31+
**Prereq:** create a GitHub Personal Access Token (repo scope). Export it in your shell:
32+
```bash
33+
export GITHUB_TOKEN=<YOUR_REPO_SCOPED_TOKEN>
34+
```
35+
Run these commands from the repo root (Ubuntu).
36+
37+
### 1) PR 1 — audit fix
38+
```bash
39+
node tools/gh-pr-open-and-merge.cjs \
40+
--repo mrhpython/Soulfield \
41+
--base main \
42+
--head fix/audit-hyphenated-identifiers \
43+
--title "fix(audit): ignore code blocks; tighten pronoun detection" \
44+
--body "Refines simulation detection to skip fenced/inline code and avoid hyphen/underscore-bound identifiers. Adds unit tests." \
45+
--labels "truth-kernel,audit"
46+
```
47+
### 2) PR 2 — node test runner
48+
```bash
49+
node tools/gh-pr-open-and-merge.cjs \
50+
--repo mrhpython/Soulfield \
51+
--base main \
52+
--head test/node-runner \
53+
--title "test: switch to Node built-in runner; convert audit tests" \
54+
--body "Replaces Mocha semantics with node:test. Updates package.json test script. Ensures zero-deps test execution in CI." \
55+
--labels "tests,truth-kernel"
56+
```
57+
### 3) Rebase docs branch after PR 1 & 2 merge
58+
```bash
59+
git switch docs/truthlens-readme-status
60+
git fetch origin
61+
git rebase origin/main
62+
npm ci && npm test && node backend/scripts/audit-truth.cjs
63+
```
64+
### 4) PR 3 — docs
65+
```bash
66+
node tools/gh-pr-open-and-merge.cjs \
67+
--repo mrhpython/Soulfield \
68+
--base main \
69+
--head docs/truthlens-readme-status \
70+
--title "docs: TruthLens runtime + audit; compliance quick checks; Codex workflow" \
71+
--body "README adds TruthLens + CI gate overview; STATUS adds compliance quick checks; TruthLens policy page gains canonical pointers." \
72+
--labels "docs,truth-kernel"
73+
```
74+
75+
---
76+
77+
## Notes
78+
- TruthLens is the governing policy; all outputs are wrapped at runtime:contentReference[oaicite:5]{index=5} and documented as OS intent:contentReference[oaicite:6]{index=6}.
79+
- Non-simulation contract applies to all agent outputs:contentReference[oaicite:7]{index=7}.
80+
- CI gate runs the Truth audit + tests on every push/PR.
81+
82+
## Troubleshooting
83+
- If the helper reports “CI failed”, click into the PR checks to view logs. Fix locally, push to the branch, rerun the helper.
84+
- If `git rebase` reports conflicts, resolve locally, `git add <files> && git rebase --continue`, then rerun the PR 3 helper command.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# spec.md
2+
3+
## Intent
4+
Build a UK-focused semantic search API that integrates Jina AI's embedding and reranking services with TruthLens verification, enabling RAG-powered document search with fact-checking capabilities for workspace knowledge bases.
5+
6+
## Acceptance Criteria
7+
1. Successfully index 100+ workspace documents via Jina Reader API
8+
2. Search response time <300ms for 95% of queries
9+
3. Rerank top-10 results with >85% relevance accuracy
10+
4. TruthLens confidence scores correlate with rerank scores (r>0.7)
11+
5. API handles 100 concurrent requests without degradation
12+
6. All responses include source citations and confidence metrics
13+
14+
## Thin-Slice MVP
15+
A REST API endpoint that accepts a search query, embeds it using Jina, searches a vector store, reranks results, and returns TruthLens-verified responses with citations.
16+
17+
```
18+
POST /api/v1/search
19+
{
20+
"query": "How does TruthLens verify facts?",
21+
"limit": 5,
22+
"verify": true
23+
}
24+
→ Returns ranked, verified results with confidence scores
25+
```
26+
27+
## Tasks (≤12)
28+
29+
### Setup [2h]
30+
1. Configure Jina API credentials and rate limits in `.env`
31+
2. Initialize PostgreSQL with pgvector extension for embeddings
32+
33+
### Core Implementation [8h]
34+
3. Create `JinaAdapter` class with embed/rerank methods
35+
4. Build document chunker (1000 tokens, 200 overlap)
36+
5. Implement batch document indexer with progress tracking
37+
6. Create vector search function with similarity threshold
38+
7. Build reranking pipeline for top-20 candidates
39+
8. Implement TruthLens verification against indexed sources
40+
41+
### API & Integration [4h]
42+
9. Create FastAPI endpoint with request/response models
43+
10. Add caching layer for frequent embeddings (Redis TTL=1h)
44+
11. Implement async processing for parallel operations
45+
46+
### Testing & Deploy [2h]
47+
12. Write integration tests with mock documents and deploy to Railway/Render
48+
49+
## Week 1 Metrics
50+
- **Indexing Volume**: 500+ documents processed
51+
- **Query Latency**: P95 <300ms, P50 <150ms
52+
- **Relevance Score**: >85% for test query set
53+
- **API Uptime**: >99% availability
54+
- **Cost Efficiency**: <£50 total API spend
55+
- **User Feedback**: 10+ beta testers provide relevance ratings
56+
57+
## Run (approved)
58+
echo "[spec] sanity checks"
59+
ls -alh /home/michael/soulfield/workspace/specs
60+
echo "[policy] show TruthLens rules"
61+
head -n 20 /home/michael/soulfield/workspace/knowledge/TruthLens.md
62+
echo "[index] first 10 lines"
63+
head -n 10 /home/michael/soulfield/workspace/data/index.json
64+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
CODEX RUNBOOK — APPLY PATCHES WITH TRUTH KERNEL SAFETY
2+
3+
Objective: Apply Aurea’s DIFFS exactly; validate with audit + tests; commit and push.
4+
5+
Steps (strict order):
6+
1) Repo prep
7+
- git status --porcelain
8+
- git pull --rebase
9+
- git checkout -b feat/<slug> || git switch feat/<slug>
10+
11+
2) Apply patches
12+
- For each ```diff block from Aurea, apply using `git apply --index --reject` (fail on rejects).
13+
- If new files: ensure directories exist before apply.
14+
15+
3) Install & build
16+
- npm ci
17+
- npm run build || true # only if build script exists
18+
19+
4) Static checks & tests
20+
- npm test
21+
- node backend/scripts/audit-truth.cjs
22+
23+
5) Dry-run and (if required) safe execute
24+
- if `sf` exists: `sf dry` # do not run `sf apply --apply` unless explicitly requested
25+
26+
6) Commit & push
27+
- git add -A
28+
- git commit -m "feat: <concise summary of change>"
29+
- git push -u origin HEAD
30+
31+
7) PR (if platform supports it)
32+
- Create PR titled "feat: <summary> (TruthKernel)"
33+
- PR body: include checklist of acceptance criteria and audit/test outputs.
34+
35+
Failure policy:
36+
- On ANY failure (apply/test/audit), stop and post the failing command, exit code, and last 120 lines of logs. No partial commits.
37+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# /brain-dump-analysis
2+
3+
Purpose: synthesize braindumps into themes, questions, breached rules, and realizations.
4+
5+
Process:
6+
- Read `braindumps/` markdown files.
7+
- Extract keywords and frequent phrases.
8+
- Identify questions (“?”), and lines like “rule(s) I keep breaking…”.
9+
- Output ASCII mind map + bullet lists.
10+
11+
Output: `braindumps/analysis/insights-YYYY-MM-DD.md`
12+
13+
## Usage
14+
15+
Ensure you have markdown files under `braindumps/`, then run:
16+
17+
```
18+
node tools/brain-dump-analysis.cjs
19+
# or
20+
node tools/sf.cjs brain-dump-analysis
21+
```
22+
23+
Generates: `braindumps/analysis/insights-<today>.md` containing themes, questions, and a simple ASCII mind map.

.chatgpt/commands/daily-brief.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# /daily-brief (markets)
2+
3+
Purpose: structured market preparation without external calls.
4+
5+
Sources:
6+
- Local workspace markdowns (keywords/interests)
7+
8+
Content:
9+
- Sessions for ES + majors FX (placeholders OK)
10+
- Checklist: econ calendar, overnight ranges, ATR%, key levels
11+
- Why-each-item-matters notes
12+
- Action checklist slots
13+
14+
Output: `briefs/daily-brief-YYYY-MM-DD.md`
15+
16+
## Usage
17+
18+
```
19+
node tools/daily-brief.cjs
20+
# or
21+
node tools/sf.cjs daily-brief
22+
```
23+
24+
The brief is structure-only (no web calls). Fill checklist items manually.

.chatgpt/commands/daily-checkin.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# /daily-checkin
2+
3+
Purpose: end-of-day reflection and planning.
4+
5+
Prompts:
6+
- mood 1–10, energy 1–10
7+
- top 3 wins
8+
- tomorrow’s #1
9+
- blockers
10+
11+
Outputs:
12+
- `journal/daily/YYYY-MM-DD.md`
13+
- `journal/daily/YYYY-MM-DD-reflection.md` (trend of last 3 days, momentum score, suggestions, best time block)
14+
15+
## Usage
16+
17+
Run from repo root (Node ≥ 20):
18+
19+
```
20+
node tools/daily-checkin.cjs
21+
# or
22+
node tools/sf.cjs daily-checkin
23+
```
24+
25+
Non-interactive (smoke) via env (good for tests/automation):
26+
27+
```
28+
TEST_INPUT='{"mood":7,"energy":6,"wins":"win1;win2;win3","tomorrow1":"Top focus","blockers":"X"}' \
29+
node tools/daily-checkin.cjs
30+
```
31+
32+
Files written:
33+
- `journal/daily/<today>.md`
34+
- `journal/daily/<today>-reflection.md`
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# /weekly-checkin
2+
3+
Purpose: capture weekly TRADING + STUDY metrics and generate a compact report.
4+
5+
Prompts to collect:
6+
- TRADING: R values list, regime tag, volatility proxy.
7+
- STUDY: focused hours, problems solved, PRs merged, tests added, coverage %, commits, learning sprints, notes.
8+
9+
Calculations:
10+
- Expectancy (R) = average(R)
11+
- Win rate = wins / N
12+
- Max drawdown (R) = min cumulative R trough
13+
- Kelly-lite (informational) = winrate – (1 – winrate)/(avg_win_R/|avg_loss_R|)
14+
- Study velocity = focused_hours + problems_solved*0.5 + PRs*0.5
15+
16+
Outputs:
17+
- Append JSON block to `metrics/metrics-history.md`
18+
- Create `metrics/weekly-report-YYYY-MM-DD.md` with tables, deltas, emoji signals, and 3–5 recommendations.
19+
20+
## Usage
21+
22+
Interactive:
23+
24+
```
25+
node tools/weekly-checkin.cjs
26+
# or
27+
node tools/sf.cjs weekly-checkin
28+
```
29+
30+
Non-interactive (CI/smoke):
31+
32+
```
33+
TEST_INPUT='{"R_list":"1 -0.5 0.7","focused_hours":5,"problems_solved":4,"prs_merged":2}' \
34+
node tools/weekly-checkin.cjs
35+
```
36+
37+
Artifacts:
38+
- `metrics/metrics-history.md` (appended block)
39+
- `metrics/weekly-report-<today>.md`
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
System: You are ChatGPT daily reflection coach. Keep tone supportive and brief.
2+
3+
Input: mood (1–10), energy (1–10), top wins, blockers, last 3 days trends.
4+
Output:
5+
- Tiny trend for mood/energy (up/down/flat)
6+
- Accomplishment momentum score
7+
- 2–3 gentle suggestions
8+
- Best time block for tomorrow (AM if trend up, PM otherwise)
9+

0 commit comments

Comments
 (0)