diff --git a/AGENTS.md b/AGENTS.md index 3c31f84d..dbf555ef 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,4 +1,4 @@ -# AGENTS.md — Mosaic Stack rebuild (`mosaicstack/stack-v2`) +# AGENTS.md — Mosaic Stack rebuild (`mosaicstack/stack`, branch `refactor`) Operational context for any agent session working in this repository. Read top to bottom; it is deliberately short — depth lives in the files it @@ -6,7 +6,15 @@ points to, not here. ## What this repository is -A standalone rebuild of Mosaic Stack: a file-based, fail-closed +Canonical checkout: `/mnt/storage/src/mosaic-stack`, origin `mosaicstack/stack`, +working branch `refactor` (Jason-authorized conversion, issue #1495). +The new foundation is at the root. `v1/` is archived legacy source, not the current +implementation; its instructions and tools do not govern the new foundation. +`~/src/mosaic-stack-dev-test` is a compatibility symlink to this checkout, not a +second working tree. Both original Git histories are retained. Conversion receipt: +`docs/plans/2026-09-07_repository-consolidation-completed.md`. + +A rebuild of Mosaic Stack: a file-based, fail-closed orchestration foundation that dispatches sandboxed headless pi workers to do real work, with immutable run records as evidence. Thirteen-plus tagged milestones (`git tag -l`) from `poc-container-hello-v0` to today; suites @@ -32,9 +40,10 @@ green at every step. Not production software — a proven foundation. 7. **Policy**: missions govern tasks (least-privilege intersection — a task narrows, never widens). Role authority is declared in `roles/` and changes only via reviewed commits. -8. **Git**: commit only after suites are green; push only `main`; never - force-push. `scripts/conductor-apply.sh` commits locally — push stays an - explicit act. +8. **Git**: commit only after applicable suites are green. Work on the + owner-authorized `refactor` branch; never force-push. Push remains an explicit + act. Do not merge into `next` or `main` without separate authorization. + `scripts/conductor-apply.sh` commits locally; it does not authorize a push. 9. **Append-only logs**: BUILD-LOG.md (phases), `activation-log.jsonl`, `.pruned.log`, docs/SESSIONS.md. Corrections are new entries, never edits. diff --git a/README.md b/README.md index 9c299fff..aa4b2023 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,25 @@ -# Minimal Mosaic Stack container POC +# Mosaic Stack — new foundation -Standalone experiment, not part of the Mosaic Stack repository or Software Factory. +The active rebuild is at this repository's root. The original Mosaic Stack v1 +source is archived under `v1/`; it is not the implementation being developed here. -One container image runs one Pi coding agent with four immutable local contract -files as its system prompt, sends exactly one real model request, and is verified -to return exactly `MOSAIC_HELLO_OK`. +- Canonical checkout: `/mnt/storage/src/mosaic-stack` +- Repository: `mosaicstack/stack` +- Working branch: `refactor` +- Former `~/src/mosaic-stack-dev-test`: compatibility symlink to this same checkout + +Both original Git histories and pending development work are preserved. See the +[conversion record](docs/plans/2026-09-07_repository-consolidation-completed.md) +and [current next action](docs/plans/CURRENT.md). Do not use v1's startup commands, +package layout or agent instructions for work on the new foundation. + +## Original container proof + +The foundation began as a standalone container experiment. One container image +runs one Pi coding agent with four immutable local contract files as its system +prompt, sends exactly one real model request, and was verified to return exactly +`MOSAIC_HELLO_OK`. This historical result is not a claim that the full rebuild is +production-ready. ## Layout diff --git a/docs/plans/2026-09-07_repository-consolidation-completed.md b/docs/plans/2026-09-07_repository-consolidation-completed.md new file mode 100644 index 00000000..53b0c80b --- /dev/null +++ b/docs/plans/2026-09-07_repository-consolidation-completed.md @@ -0,0 +1,95 @@ +# Repository conversion #1495 — local completion record + +Owner instruction: "Nothing is working in the repo now. Get the conversion completed." +Tracking: https://git.mosaicstack.dev/mosaicstack/stack/issues/1495. +Coordinator: darkwing. Date: 2026-09-07 UTC. + +## One authoritative checkout + +- Canonical root: `/mnt/storage/src/mosaic-stack`. +- New Mosaic Stack foundation: root-level source, scripts, contracts and docs. +- Legacy Mosaic Stack: `v1/`, retained as archival source, not an active deployment. +- Working branch: `refactor`. +- Origin: `https://git.mosaicstack.dev/mosaicstack/stack`. +- `/home/jwoltje/src/mosaic-stack-dev-test` is a compatibility symlink to the + canonical root. It is not a second working tree. +- Exactly one top-level `.git`; no nested `v1/.git`. + +The original v2 repository is retained as the `stack-v2-archive` fetch remote; +its push URL is deliberately disabled. No remote repository was deleted or pushed. +The canonical branch has no automatically configured push/upstream authority. + +## Git and pending-work preservation + +Original heads: +- v1: `5d2770002612a09ae0cadc129b4ea30619133e8a` (`next`). +- v2: `9a5fbdbda74b16adf488fe28138b2ba69ea5e669` (`main`). + +The local conversion merge preserves both histories. Its first parent is the v2 +head, its second parent is the v1 head. The selected root tree is v2; the exact +tracked v1 tree is imported under `v1/`. This is not a merge into `next` or `main`. +All v1 refs are additionally preserved below `refs/archive/v1/`; original v2 refs +remain available. Accepted source/review SHA citations still resolve. + +Only the 3,507 already-tracked v1 paths and these four conversion documentation +paths belong to the conversion commit: +- `AGENTS.md` +- `README.md` +- this completion record +- `docs/plans/reviews/2026-09-07_repository-conversion-verification.json` + +All earlier v2 tracked modifications, untracked inspector/source/reviews, ignored +files and generated/dependency state were copied without bulk staging. They remain +pending work, not silently committed or approved. Legacy ignored/local files were +preserved on disk but were not automatically added to Git. No source implementation +bytes, role authority or immutable inspector inputs were changed by the conversion. + +## Verification + +Full pre-cutover snapshots and staged copies matched file hashes, types, permissions, +UID/GID, symlink targets and regular-file mtimes. Both sources were checked again +for drift immediately before cutover. Post-cutover payload checks matched as well. +Inventories: 4,149 v1 entries including Git metadata; 15,734 v2 entries including Git +metadata/dependencies; 4,105 legacy payload entries excluding `.git`. + +From the canonical checkout with synthetic HOME/TMPDIR and no provider credentials: +- Inspector Node tests: 80 passed. +- Inspector selftests: 43 passed. +- Schema oracle: zero disagreements, 1,568 records. +- Foundation checker: passed, with its existing synthetic/runtime limitations. +- Config/auth/conductor tests: 24/15/17 passed. +- Network/engine command guards were not invoked. +- All 382 approved r6 inspector file identities and every pinned input were unchanged + before and after the tests. + +Command/log receipts: `docs/plans/reviews/2026-09-07_repository-conversion-verification.json`. +Git object integrity and exact archival tree/parent relationships are checked before +and after the local commit. No v1 build, service, native runtime or deployment test +was run. Task/release suites remain NOT RUN / DEFERRED; the previous offline-demo +ruling is not expanded into deployment acceptance by this conversion. + +## Rollback material — outside the repository + +Verified copies and private inventories: +`/mnt/storage/src/.mosaic-stack-conversion-20260907T172430Z/` + +This contains `before-v1/`, `before-v2/`, `retired-v1-original/`, inventory JSON, +conversion state and verification logs. The original v2 directory is also retained: +`/home/jwoltje/src/.mosaic-stack-dev-test.pre-conversion-20260907T172430Z`. + +These are retired rollback copies, not alternative development roots. Do not edit +or launch from them. Before any rollback, stop writers and preserve any new work. +A rollback must move the converted checkout aside, verify/remove only the old-v2 +compatibility symlink, and restore the two original directories to their original +paths. Never overwrite/delete newer work or use blanket recursive deletion. + +## Remaining boundaries + +No push, PR merge, live service/config/data migration, package install or history +rewrite occurred. The old absolute v2 path remains usable through the explicit +compatibility link; historical evidence was not bulk rewritten to claim new paths. +Future work should use the canonical path above. Reopen sessions there when convenient. + +The inspector is independently code-approved for the bounded offline demo; Jason's +A9 demo acceptance remains pending. Neither that acceptance nor future runtime +permissions are granted by the repository conversion. diff --git a/docs/plans/reviews/2026-09-07_repository-conversion-verification.json b/docs/plans/reviews/2026-09-07_repository-conversion-verification.json new file mode 100644 index 00000000..03b8b15e --- /dev/null +++ b/docs/plans/reviews/2026-09-07_repository-conversion-verification.json @@ -0,0 +1,88 @@ +{ + "timestamp": "2026-09-07T17:28:52.068419+00:00", + "canonical": "/mnt/storage/src/mosaic-stack", + "approvedInspectorManifest": "a4a4493000aff5905337a643886ca36e7c5377d52deed77b8aeab7174ca73dcf", + "inspectorFiles": 382, + "identitiesAndPinsUnchangedBeforeAfter": true, + "forbiddenGuardsInvoked": false, + "receipts": [ + { + "name": "inspector-node", + "command": [ + "node", + "--test", + "scripts/foundation/" + ], + "exit": 0, + "log": "/mnt/storage/src/.mosaic-stack-conversion-20260907T172430Z/verification/inspector-node.log", + "sha256": "b2a2b23002de082c23353e3529889276cabbb60b00177ee26eb538702e87c526" + }, + { + "name": "inspector-selftests", + "command": [ + "bash", + "scripts/test-foundation.sh" + ], + "exit": 0, + "log": "/mnt/storage/src/.mosaic-stack-conversion-20260907T172430Z/verification/inspector-selftests.log", + "sha256": "e856f3fd68bcca7442f809e7a53af4aa674fd6483486120d429917688c4216a2" + }, + { + "name": "schema-oracle", + "command": [ + "python3", + "scripts/foundation/verify-schema.py" + ], + "exit": 0, + "log": "/mnt/storage/src/.mosaic-stack-conversion-20260907T172430Z/verification/schema-oracle.log", + "sha256": "40e7311b1aed62c12aaba4ad4dd9eca3d43b46b2785f1abc4263be9d85e93653" + }, + { + "name": "foundation-checker", + "command": [ + "python3", + "docs/plans/foundation-v1-candidate/check.py" + ], + "exit": 0, + "log": "/mnt/storage/src/.mosaic-stack-conversion-20260907T172430Z/verification/foundation-checker.log", + "sha256": "42ddd578b4f2be0c0b7b5b78a95de3a94e7d372661f634eb6f5209aa55e0c60a" + }, + { + "name": "test-config", + "command": [ + "bash", + "scripts/test-config.sh" + ], + "exit": 0, + "log": "/mnt/storage/src/.mosaic-stack-conversion-20260907T172430Z/verification/test-config.log", + "sha256": "52d211444489ea729dafc3c9745d4474d9dfd50f41055cbad792424197f04073" + }, + { + "name": "test-auth", + "command": [ + "bash", + "scripts/test-auth.sh" + ], + "exit": 0, + "log": "/mnt/storage/src/.mosaic-stack-conversion-20260907T172430Z/verification/test-auth.log", + "sha256": "f91fc95a173339137f981e24fbf630acfde957e32c3cd71e28304532083c6a77" + }, + { + "name": "test-conductor", + "command": [ + "bash", + "scripts/test-conductor.sh" + ], + "exit": 0, + "log": "/mnt/storage/src/.mosaic-stack-conversion-20260907T172430Z/verification/test-conductor.log", + "sha256": "e1206366f07f3d9029530dcdcb55c0282d3f052adc60fc7fd51642d5d4ec3600" + } + ], + "notRun": [ + "test-task.sh", + "test-release.sh", + "v1 build/tests", + "live/native/provider/deployment checks" + ], + "deferralBoundary": "Prior owner offline-demo deferral retained, not widened into deployment acceptance. This conversion changes filesystem/Git layout and documentation, not executable source." +} diff --git a/v1/.env.example b/v1/.env.example new file mode 100644 index 00000000..a42e332e --- /dev/null +++ b/v1/.env.example @@ -0,0 +1,16 @@ +# Mosaic Stack standalone deployment (compose `stack` profile) +# Copy to .env and adjust. Port overrides exist because the defaults +# collide with common host services (and with the dev compose itself). +PG_HOST_PORT=5433 +VALKEY_HOST_PORT=6380 +GATEWAY_HOST_PORT=14242 +# Registry image override (defaults to a local build of docker/gateway.Dockerfile): +# GATEWAY_IMAGE=git.mosaicstack.dev/mosaicstack/stack/gateway:sha-acf640d + +# Optional explicit dogfood overlay (docker-compose.dogfood.yml). +# All three paths are required when that overlay is used. Use a dedicated +# next-based worktree, its canonical clone's .git directory, and the external +# home of the unprivileged code-dogfood-01 functional seat. +# MOSAIC_DOGFOOD_WORKTREE=/home/example/src/mosaic-stack-worktrees/dogfood-1487 +# MOSAIC_DOGFOOD_COMMON_GIT_DIR=/home/example/src/mosaic-stack/.git +# MOSAIC_DOGFOOD_SEAT_HOME=/home/example/.mosaic/fleet/agents/code-dogfood-01 diff --git a/v1/.gitignore b/v1/.gitignore new file mode 100644 index 00000000..74f888d6 --- /dev/null +++ b/v1/.gitignore @@ -0,0 +1,29 @@ +logs/ +node_modules +dist +.turbo +.next +coverage +.env +.env.local +*.tsbuildinfo +.pnpm-store +__pycache__/ +docs/.obsidian + +# Step-CA dev password — real file is gitignored; commit only the .example +infra/step-ca/dev-password + +# Scratch dirs created by the framework git-wrapper shell test harnesses +.mosaic-test-work/ + +# Transient config files vite/vitest/esbuild write next to a *.config.ts while +# loading it, then unlink. They are untracked but were not ignored, so turbo's +# package traversal hashed them and intermittently failed CI with "Package +# traversal error: ... .timestamp-*.mjs: No such file or directory" when the +# file vanished mid-scan. Ignoring them removes the race. +*.timestamp-*.mjs + +# Playwright run artifacts (#1445, P6 E2E gate) +apps/web/test-results/ +apps/web/playwright-report/ diff --git a/v1/.husky/pre-commit b/v1/.husky/pre-commit new file mode 100755 index 00000000..2312dc58 --- /dev/null +++ b/v1/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/v1/.husky/pre-push b/v1/.husky/pre-push new file mode 100755 index 00000000..aae2e7e1 --- /dev/null +++ b/v1/.husky/pre-push @@ -0,0 +1 @@ +pnpm preflight && pnpm typecheck && pnpm lint && pnpm format:check diff --git a/v1/.lintstagedrc b/v1/.lintstagedrc new file mode 100644 index 00000000..b4954113 --- /dev/null +++ b/v1/.lintstagedrc @@ -0,0 +1,9 @@ +{ + "**/*.{ts,tsx,js,jsx}": [ + "prettier --write", + "eslint --fix" + ], + "**/*.{json,md,yaml,yml}": [ + "prettier --write" + ] +} diff --git a/v1/.mosaic/README.md b/v1/.mosaic/README.md new file mode 100644 index 00000000..dd289aa0 --- /dev/null +++ b/v1/.mosaic/README.md @@ -0,0 +1,78 @@ +# Repo Mosaic Linkage + +This repository is attached to the machine-wide Mosaic framework. + +## Load Order for Agents + +1. `~/.config/mosaic/STANDARDS.md` +2. `AGENTS.md` (this repository) +3. `.mosaic/repo-hooks.sh` (repo-specific automation hooks) + +## Purpose + +- Keep universal standards in `~/.config/mosaic` +- Keep repo-specific behavior in this repo +- Avoid copying large runtime configs into each project + +## Optional Quality Rails + +Use `.mosaic/quality-rails.yml` to track whether quality rails are enabled for this repo. + +Apply a template: + +```bash +~/.config/mosaic/bin/mosaic-quality-apply --template