Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions .github/workflows/desk-and-gym.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Desk and gym

on:
pull_request:
branches: [main]
paths:
- '.github/workflows/desk-and-gym.yml'
- 'godbrain_core/cpp_kernel/**'
- 'godbrain_core/cpp_tools/**'
- 'godbrain_core/skill_lab/**'
- 'scripts/**'
push:
branches: [main]
paths:
- '.github/workflows/desk-and-gym.yml'
- 'godbrain_core/cpp_kernel/**'
- 'godbrain_core/cpp_tools/**'
- 'godbrain_core/skill_lab/**'
- 'scripts/**'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: desk-and-gym-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
windows:
runs-on: windows-2022
timeout-minutes: 25
defaults:
run:
shell: pwsh
env:
GODBRAIN_GYM_MONGO_URI: mongodb://127.0.0.1:27917/godbrain_gym
GODBRAIN_GYM_REQUIRE_MONGO: '1'
GODBRAIN_SHARED_LESSONS_TEST_URI: mongodb://127.0.0.1:27917/godbrain_gym_memory
GODBRAIN_SHARED_LESSONS_MONGO_URI: mongodb://127.0.0.1:27917/godbrain_gym_memory
GODBRAIN_BUILDER_MONGO_URI: mongodb://127.0.0.1:27917/godbrain_builder_test
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: '24'
cache: npm
cache-dependency-path: godbrain_core/skill_lab/package-lock.json
- name: Start disposable native Mongo
run: |
$ErrorActionPreference = 'Stop'
$tools = Join-Path $env:RUNNER_TEMP 'native-mongo'
New-Item -ItemType Directory -Force -Path $tools | Out-Null
$packages = @(
@{
Name = 'server'
Url = 'https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-8.0.17.zip'
Hash = '39f0b72797f73e0909da3b454739d0f86bfcd5df436509f43d3df1aeeafc30e3'
},
@{
Name = 'shell'
Url = 'https://github.com/mongodb-js/mongosh/releases/download/v2.14.1/mongosh-2.14.1-win32-x64.zip'
Hash = 'be58d3c67a2bca990c790b359c99fa9b5da1b12bb5b01e8442bea5998b1a38e2'
}
)
foreach ($package in $packages) {
$zip = Join-Path $tools ($package.Name + '.zip')
Invoke-WebRequest -Uri $package.Url -OutFile $zip
if ((Get-FileHash $zip -Algorithm SHA256).Hash -ne $package.Hash) {
throw "Published checksum mismatch: $($package.Name)"
}
Expand-Archive -LiteralPath $zip -DestinationPath (Join-Path $tools $package.Name)
}
$server = @(Get-ChildItem (Join-Path $tools 'server') -Filter mongod.exe -Recurse)
$shell = @(Get-ChildItem (Join-Path $tools 'shell') -Filter mongosh.exe -Recurse)
if ($server.Count -ne 1 -or $shell.Count -ne 1) { throw 'Ambiguous Mongo binaries.' }
"GODBRAIN_MONGOSH=$($shell[0].FullName)" >> $env:GITHUB_ENV
$data = Join-Path $tools 'data'
New-Item -ItemType Directory -Path $data | Out-Null
$mongo = Start-Process -FilePath $server[0].FullName -PassThru -ArgumentList @(
'--bind_ip', '127.0.0.1', '--port', '27917', '--quiet',
'--dbpath', "`"$data`"", '--logpath', "`"$(Join-Path $tools 'mongod.log')`""
)
@{
Pid = $mongo.Id
Path = $server[0].FullName
Started = $mongo.StartTime.ToUniversalTime().Ticks
} | ConvertTo-Json | Set-Content (Join-Path $tools 'process.json')
$ready = $false
for ($attempt = 0; $attempt -lt 30; $attempt++) {
if ($mongo.HasExited) { throw 'Disposable Mongo exited before readiness.' }
& $shell[0].FullName 'mongodb://127.0.0.1:27917/admin?serverSelectionTimeoutMS=1000' `
--quiet --norc --eval 'quit(db.runCommand({ping:1}).ok === 1 ? 0 : 1)' *> $null
if ($LASTEXITCODE -eq 0) { $ready = $true; break }
Start-Sleep -Seconds 1
}
if (-not $ready) { throw 'Disposable Mongo never became ready.' }
- name: Install checked-in lab dependencies and browser
working-directory: godbrain_core/skill_lab
run: |
npm ci --ignore-scripts --no-audit --no-fund
if ($LASTEXITCODE) { throw 'npm ci failed.' }
npx --no-install playwright install chromium
if ($LASTEXITCODE) { throw 'Chromium installation failed.' }
$browser = node --input-type=module -e "import {chromium} from 'playwright'; console.log(chromium.executablePath());"
if ($LASTEXITCODE -or -not (Test-Path -LiteralPath $browser)) { throw 'Chromium is missing.' }
"GODBRAIN_BROWSER=$browser" >> $env:GITHUB_ENV
- name: Full browser, worker and real Mongo tests
run: |
New-Item -ItemType Directory -Force -Path logs | Out-Null
Push-Location godbrain_core\skill_lab
try {
npm test 2>&1 | Tee-Object -FilePath ..\..\logs\ci-gym.log
if ($LASTEXITCODE) { throw 'Frontend gym tests failed.' }
} finally { Pop-Location }
- name: Native production link and reply fixtures
run: |
.\scripts\Test-KernelReplies.ps1 2>&1 | Tee-Object -FilePath logs\ci-native.log
- name: Desk payload and native UI smoke
run: |
try {
.\scripts\Test-DeskMenu.ps1 -UiSmoke 2>&1 | Tee-Object -FilePath logs\ci-desk.log
.\scripts\Test-DeskModel.ps1
.\scripts\Test-DeskAttachments.ps1
.\scripts\Test-ClipShare.ps1
} catch {
Write-Host $_.ScriptStackTrace
throw
}
- name: Stop only the disposable Mongo process
if: always()
run: |
$file = Join-Path $env:RUNNER_TEMP 'native-mongo\process.json'
if (Test-Path -LiteralPath $file) {
$owned = Get-Content -LiteralPath $file -Raw | ConvertFrom-Json
$process = Get-Process -Id $owned.Pid -ErrorAction SilentlyContinue
if ($process) {
if ($process.Path -ne $owned.Path -or
$process.StartTime.ToUniversalTime().Ticks -ne $owned.Started) {
throw 'Refusing to stop a reused or unrelated Mongo PID.'
}
Stop-Process -Id $process.Id
}
}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: desk-and-gym-evidence
path: |
logs/ci-*.log
${{ runner.temp }}/native-mongo/mongod.log
retention-days: 7
21 changes: 21 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@ surface extraction failures. Keep personal and technical recall isolated;
stored/candidate does not mean verified. This intake integration is a target,
not a claim that every input type is already wired.

- **One-request Golden Records.** An explicit operator request such as
"please make this a Golden Record" supplies the human judgment for the
identified, completed result. The agent handles canonical candidate ingestion,
then authenticated `/api/judge` / `set_godbrain_status` with the operator's
request and concrete evidence as the reasoning. Do not ask the operator to
repeat the decision with `/verify`. This is delegated execution of their
judgment, not model self-verification; praise alone is not promotion authority.
Keep the symptom, observed dependency, scoped fix, checks, operator-confirmed
outcome and unresolved limits. Never invent an isolated culprit from a group
change, or turn a successful historical recovery into proof of current readiness.
Search existing records first; preserve immutable sources, candidate-only ingest,
bearer authorization, source/freshness gates and personal-sector isolation.
Read back the committed verified record and check canonical retrieval before
claiming it is available to future integrated callers; report any blocked step.
- **Raw is immutable.** Sources (transcripts, observe blobs, session files)
are never edited after ingest. Librarian and chat must not rewrite the
source to match a later opinion.
Expand Down Expand Up @@ -301,6 +315,13 @@ seed tank cards.

### This host: Windows SRE (B-line)

Prioritize the SRE evidence library before expanding agent autonomy. Ordinary
coding and host troubleshooting should accumulate reusable, operator-judged
incident cases: symptom, dependency evidence, scoped intervention, verification
and limits. Make those historical cases canonically retrievable; they are not
live readiness probes or permission to replay a repair. Do not build a blind
repair loop in place of that library.

B-line is closed-loop OS/network on this host: detect → reason →
allowlist patch → verify.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The GodBrain turns local models into a shared, sovereign cognitive system. The c
- **🧠 Model-agnostic mouth** — Plug in an **OpenAI-compatible** `/v1/chat/completions` server. Desk default: Qwen 3.8 27B EXL3 on `:8888`.
- Not an arbitrary chat API. No model is special; they inherit the same teachings.

- **📚 Models teach models** — Librarian writes **candidate** Golden Records; you `/verify` or `/reject`. Chat retrieves **committed** teachings through rag-service (`:8084`), so the next model does not start from a blank context. That is the query path — not a Mongo shell.
- **📚 Models teach models** — Librarian writes **candidate** Golden Records; you `/verify` or `/reject`. Saying **"make this a Golden Record"** is also your judgment: the agent saves the evidence, submits that decision and checks canonical retrieval without a second approval step. Chat retrieves **committed** teachings through rag-service (`:8084`), so the next model does not start from a blank context. That is the query path — not a Mongo shell.

- **Shared working memory** — Integrated Desk and PowerShell clients recall the
same bounded host index, discussion and research shelves across fresh sessions.
Expand All @@ -56,7 +56,7 @@ Mongo + RAG-service is the vault. The mouth is just compute. A bigger card, a fu
This machine has **one generate slot** (Qwen 3.8 27B EXL3 3.5bpw on the 16 GB card). A 3090 replacing the 4080 would still use a single slot, not a second mouth and not a silent swap to GLM MoE.

Hybrid ingest is real: drop a source in `inbox\` or POST `/api/librarian`. The local mouth extracts **candidates**. You crown them.
Cloud models do not skip `/verify`, do not get a Mongo shell, and do not run `wsudo`. Privileged PowerShell still needs bearer + reasoning. Heal does not DISM, rewrite the registry, or patch a fleet.
Cloud models cannot self-verify; they may execute an explicit operator judgment through the same authenticated status door. They do not get a Mongo shell or run `wsudo`. Privileged PowerShell still needs bearer + reasoning. Heal does not DISM, rewrite the registry, or patch a fleet.

## See it running

Expand Down
66 changes: 52 additions & 14 deletions docs/desk-menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,20 @@ semantically reclassified or trimmed as supposed reasoning.

### Ask text modes

The visible selector defaults to **Research (read-only)**. **Answer** disables
model tools even with a Path; an explicit leading `No tools` also wins over
the selector. **Research** advertises only reads and enforces read-only
arguments after alias normalization, even when YOLO is active. It cannot
apply `/edit`, write files/registry/ACLs, elevate or change services.
The visible selector defaults to **Research (read-only)**. **Answer (read-only
tools)** can also inspect files, registry, services and documentation before
answering; it uses a shorter tool loop. An explicit leading `No tools` disables
tools and wins over the selector. Both modes advertise only reads and enforce read-only
arguments after alias normalization, even when YOLO is active. They cannot
apply `/edit`, write files/registry/ACLs, open an arbitrary privileged shell
or change services. The fixed authenticated metadata reader below is the
only privileged-read exception.
**Fix** retains existing scoped tools, jail, bearer and sovereignty checks;
it does not grant YOLO or elevation. Explicit authenticated operator
`/yolo`, `/verify` and `/reject` commands retain their separate gates.
Images and complete-source review retain their dedicated read-only/generated-image routes.

Research can query service configuration (`run_host`, `exe=sc`, `args=qc SERVICE`)
Both modes can query service configuration (`run_host`, `exe=sc`, `args=qc SERVICE`)
and inspect a registry key or granted file/folder using `read_local_acl`.
Host reads use the same executable-prefix normalization as the native executor.
Registry reads accept either `args=query "KEY" ...` or `path=KEY` (quoted by
Expand All @@ -232,16 +235,28 @@ private client history is not automatically imported. After an explicit
`index`, authenticated ordinary requests retrieve relevant shared working
research and the target-host snapshot automatically. Published working
context is not verified knowledge.
Research retains up to 32 KiB of complete, distinct observations, including
Answer and Research retain up to 32 KiB of complete, distinct observations, including
on Continue. It does not evict earlier facts to fit later reads. Repeated
identical results are deduplicated; a round with no new evidence ends tool
collection. Capacity exhaustion preserves earlier observations and explicitly
marks omitted new evidence before the final answer. Service observations
include the exact invocation so a failed query is not attributed to another service.
There is no separate 11 KiB per-result ceiling: a complete 15.6 KiB task brief
fits the existing ledger and is delivered to the next model round.
`inspect_protected_directory` requires a fresh authenticated request and an
operator-named directory. It returns names and complete owner/group/DACL SDDL
only, at depth one with an explicit 80-entry bound. An isolated native helper
uses backup-read privilege; if unavailable it can launch that exact helper
through the existing administrator launcher. It never uses a TI shell,
takes ownership, edits ACLs, reads file contents or inherits authorization
from a saved chain. The directory must remain in the file jail or be the
named CodeIntegrity `CIPolicies\Active` / SystemProfile Defender directory;
resolved-path changes/reparse traversal fail closed. An Everyone deny is
reported as evidence, not silently removed.
`read_local_file` decodes BOM-marked UTF-16LE/BE and UTF-8 before line slicing.
The source-read and decoded-text bounds remain 256 KiB; clipped text is marked,
malformed UTF-16 fails explicitly, and binary files remain rejected.
Research can also
Both modes can also
search Microsoft Learn and read an exact documentation URL supplied by the
operator or that request's search. Search terms must come from the operator
question or a fixed public Windows access-control vocabulary, not private
Expand All @@ -250,20 +265,32 @@ in the source receipt. First-party fetches reuse the bounded
HTTPS/allowlisted-host/HTTP-200/no-redirect transport. Text remains an
**untrusted reference**, never an automatically verified claim or proof of
the actual writer on this host. Documentation tools require no paid API.
Large/earlier research results are explicitly omitted rather than cut through
a reference. Ask shows the effective mode, actual model tool attempts and any
`read_public_url` additionally reads an exact operator-supplied public HTTPS
URL (or documentation-search result). It runs in a bounded native helper
using Windows' existing curl client with configuration/proxy/auth/cookies
disabled and the connection pinned to a validated public IPv4. No private,
loopback, link-local or reserved destination, redirects, query strings,
fragments or arbitrary model-generated URLs are accepted. TLS validation
remains enabled. Results are bounded, explicitly clipped untrusted text;
this is not an unrestricted web-search service or a paid API dependency.
Results exceeding the remaining ledger capacity are explicitly omitted rather
than cutting through a reference. Ask shows the effective mode, actual model tool attempts and any
answer retry; failed attempts are explicitly marked as incomplete evidence.
Empty, truncated or repetitive native Research drafts get one fresh, tools-off
Empty, truncated or repetitive native read-only drafts get one fresh, tools-off
answer attempt, never a replay of the discarded draft. Failed recovery is an
explicit error rather than an apparently finished partial table.
The same bounded recovery applies when the final streamed reasoning/answer
loops or returns no visible answer. Research emits answer text only after a complete answer is accepted;
loops or returns no visible answer. Both modes emit answer text only after a complete answer is accepted;
progress pings continue while generating, and discarded drafts never stream
into the displayed answer. The saved thinking preference is unchanged.
Failed model requests finalize an existing task as failed rather than leaving it
running. Saved task diagnostics include HTTP status, finish reason and
visible/reasoning byte counts, never private reasoning text.
Receipts are execution metadata, not task verification.
`context_supplied` distinguishes a successful tool execution from delivery
of its result to a model round. Ask explicitly reports omitted observations.
`content_retained=false` means the execution-metadata row itself does not
store source content; complete retained context is in the separate ledger.
The API field is `tool_mode: "answer"|"research"|"fix"`; omitted mode preserves
legacy clients. A running read-only chain retains its restrictions on Continue.

Expand Down Expand Up @@ -555,9 +582,20 @@ reported separately and is not disguised as successful public readiness.
Drop local video/audio files into Inbox. Originals remain untouched. Published
H.264/AAC MP4 or MP3 files get seven-day read-only share links; the source library
requires login as `owner` (Copy login copies the generated password).
Copy link selects the latest completed, unexpired share. Links are bearer
Copy link selects the newest active readable owner share from the live Copyparty
database, including manually created and never-expiring shares, not a cached
import receipt. Expired/revoked shares cannot be selected. Links are bearer
access and forwardable. Expiration revokes access, not storage.
Fresh installations default to `http://127.0.0.1:3923` links on this PC only.
The backend and owner Library stay on `http://127.0.0.1:3923`; native sharing
requires a public HTTPS hostname and rejects loopback recipient links.
That same origin configures Copyparty's `shr-site`: creation/QR and the share
page's sharekey link use the public hostname. Its separate LAN navigation stays
private.
Public share-folder links, including existing directory shares, automatically
open the minimal ClipShare player when the share grants anonymous access to
`watch.html`. QR/download query routes and shares without a player are preserved;
the owner Library remains private. These behaviors require the separately
installed ClipShare backend; it is not bundled in this repository.
Public HTTPS requires separately approved ingress setup, restricted proxy routes
and outside-network verification; Desk preserves that saved configuration.
The native status deliberately reports local readiness only: its external
Expand Down
Loading
Loading