Skip to content

Commit e6ad1bb

Browse files
author
Michael
committed
Resolve conflicts for PR #13
2 parents 6f47227 + e171dbc commit e6ad1bb

229 files changed

Lines changed: 20126 additions & 1202 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: 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: 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+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
System: You are ChatGPT metrics analyst. Be concise, numerical, and actionable. Use tables, deltas, and emoji signals (🚀 📈 📉 ➡️).
2+
3+
Given weekly TRADING R data and STUDY metrics, compute:
4+
- Expectancy (R), Win rate, Max drawdown (R)
5+
- Kelly-lite signal (informational only)
6+
- Study velocity
7+
Then produce 3–5 concrete recommendations.
8+

.env.example

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,70 @@
1-
## Copy to `.env` and fill values
1+
## Copy this file to `.env` and fill in values.
2+
## Only `.env` is loaded at runtime; this is just a template.
23

3-
# Core
4+
# ---- Core (Aiden / API server) ----
5+
# Anthropic key (preferred env var name)
6+
ANTHROPIC_API_KEY=
7+
# Legacy/alternate name (also supported)
48
CLAUDE_API_KEY=
5-
AIDEN_MODEL=
9+
# Claude model used by Aiden
10+
AIDEN_MODEL=claude-opus-4.1-20250805
11+
# Run offline when 1 (returns "dev offline"); set 0 for live API calls
12+
DEV_NO_API=0
13+
# HTTP port for backend/index.cjs
14+
PORT=8790
15+
CONTEXT_SPINE=0
16+
17+
# ---- Embeddings ----
18+
# Provider for text embeddings used by memory and context spine
19+
EMBED_PROVIDER=local # local | openai
20+
# Model name for OpenAI provider only
21+
EMBED_MODEL=text-embedding-3-small # used only if EMBED_PROVIDER=openai
22+
# Heartbeat embedding throttle (embed 1 of every N heartbeats)
23+
HEARTBEAT_EMBED_EVERY=4 # embed one of every N heartbeats
24+
OBSIDIAN_DIR=./workspace/docs/Obsidian
25+
NOTES_DIR=./workspace/docs/Obsidian
26+
27+
# Retention (days) for context items (heartbeats/calendar past events)
28+
CONTEXT_RETENTION_DAYS=14
29+
30+
# ---- Vector Memory (Pinecone + embeddings) ----
31+
# Enable Pinecone-backed memory (1 to enable)
32+
USE_PINECONE=0
33+
# Pinecone credentials and index settings
34+
PINECONE_API_KEY=
35+
PINECONE_INDEX=soulfield-memory
36+
PINECONE_CLOUD=aws
37+
PINECONE_REGION=us-east-1
38+
# OpenAI API key for embeddings (1536-dim)
639
OPENAI_API_KEY=
40+
# Optional: batch size for upserts
41+
MEMORY_UPSERT_BATCH=64
742

8-
# Optional adapters
43+
# ---- Adapters ----
44+
# Jina API (embeddings/rerank)
945
JINA_API_KEY=
46+
# Default embedding model for tools/test-memory-suite.cjs
47+
JINA_MODEL=jina-embeddings-v2-base-en
48+
49+
# InfraNodus API
1050
INFRANODUS_API_KEY=
51+
# Optional custom base URL
52+
INFRANODUS_API_BASE=https://api.infranodus.com
1153

12-
# Vector memory (optional)
13-
USE_PINECONE=0
14-
PINECONE_API_KEY=
54+
# Bright Data (scraper)
55+
BRIGHTDATA_TOKEN=
56+
57+
# ---- Misc / Tooling ----
58+
# GitHub automation scripts
59+
GITHUB_TOKEN=
60+
# Optional hint if you swap embedding providers (not read by current code)
61+
# EMBED_PROVIDER=openai
1562

63+
# ---- Google Calendar (OAuth2) ----
64+
# Used by contextSpine.js for calendar sync
65+
GCAL_CLIENT_ID=
66+
GCAL_CLIENT_SECRET=
67+
GCAL_REDIRECT_URI=
68+
GCAL_REFRESH_TOKEN=
69+
GCAL_WINDOW_HOURS=24
70+
GCAL_CALENDAR_ID=primary

.github/workflows/ci.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ name: CI
22

33
on:
44
push:
5+
<<<<<<< HEAD
6+
=======
7+
<<<<<<< HEAD
8+
=======
59
branches: [ main, feat/**, fix/**, docs/**, chore/** ]
10+
>>>>>>> origin/main
11+
>>>>>>> origin/main
612
pull_request:
7-
branches: [ main ]
813

914
jobs:
1015
node:
@@ -19,8 +24,28 @@ jobs:
1924
cache: 'npm'
2025
- name: Install deps
2126
run: npm ci
27+
<<<<<<< HEAD
28+
- name: API health (offline)
29+
run: |
30+
DEV_NO_API=1 node backend/index.cjs & echo $! > api.pid
31+
for i in {1..20}; do
32+
if curl -fsS http://127.0.0.1:8790/health >/dev/null; then
33+
curl -fsS http://127.0.0.1:8790/health | tee health.json; break
34+
fi
35+
sleep 0.3
36+
done
37+
kill $(cat api.pid)
38+
- name: Run ESLint (npx ESLint v8)
39+
run: npx -y eslint@8 .
40+
continue-on-error: true
41+
- name: Lint (if present)
42+
run: npm run -s lint --if-present
43+
- name: Test (if present)
44+
run: npm run -s test --if-present
45+
=======
2246
- name: Run tests (node:test)
2347
run: npm test
48+
>>>>>>> origin/main
2449

2550
python:
2651
runs-on: ubuntu-latest
@@ -31,5 +56,22 @@ jobs:
3156
uses: actions/setup-python@v5
3257
with:
3358
python-version: '3.11'
59+
<<<<<<< HEAD
60+
- name: Install deps (if requirements.txt)
61+
run: |
62+
if [ -f requirements.txt ]; then
63+
python -m pip install --upgrade pip
64+
pip install -r requirements.txt
65+
fi
66+
- name: Run pytest if tests are present
67+
run: |
68+
if ls -1 tests test_*.py 2>/dev/null | grep -q .; then
69+
pip install pytest
70+
PYTHONPATH=. pytest -q
71+
else
72+
echo "No python tests found; skipping"
73+
fi
74+
=======
3475
- name: Sanity
3576
run: python --version
77+
>>>>>>> origin/main

0 commit comments

Comments
 (0)