Skip to content

Commit 282cd11

Browse files
committed
Phase 0: scaffold, pinned dependencies, D:-pinned environment, verification checks (plan v2.3)
0 parents  commit 282cd11

21 files changed

Lines changed: 5991 additions & 0 deletions

‎.env.example‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RAG Platform — local environment template (copy to .env; never commit .env)
2+
# Placeholders only — no secrets. Defaults keep outbound network disabled.
3+
4+
# Egress guard (invariant I3 / Z4): off = no data leaves the machine except loopback Ollama
5+
EGRESS_MODE=off
6+
7+
# Local Ollama endpoint (Z3)
8+
OLLAMA_BASE_URL=http://localhost:11434
9+
10+
# API port
11+
PORT=8000

‎.gitignore‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Secrets and local env
2+
.env
3+
4+
# All operational data lives under data\ (gitignored entirely; plan v2.3 §11)
5+
data/
6+
7+
# Generated outputs
8+
reports/
9+
*.db
10+
11+
# Caches and environments (all on D: via scripts\env.ps1)
12+
.venv/
13+
.cache/
14+
.python/
15+
__pycache__/
16+
*.pyc
17+
.ruff_cache/
18+
19+
# Raw corpora and models (frozen eval datasets\ ARE committed; raw corpora are not)
20+
corpora/
21+
models/

‎RAG_Platform_Master_Plan.md‎

Lines changed: 534 additions & 0 deletions
Large diffs are not rendered by default.

‎RAG_Platform_Master_Plan_v2.1.md‎

Lines changed: 561 additions & 0 deletions
Large diffs are not rendered by default.

‎RAG_Platform_Master_Plan_v2.2.md‎

Lines changed: 576 additions & 0 deletions
Large diffs are not rendered by default.

‎RAG_Platform_Master_Plan_v2.3.md‎

Lines changed: 630 additions & 0 deletions
Large diffs are not rendered by default.

‎RAG_Platform_Master_Plan_v2.md‎

Lines changed: 558 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# RAG Platform — Plan Change Note (v2.0 → v2.1)
2+
3+
**Document:** `RAG_Platform_Plan_Change_Note_v2.1.md` — 2026-10-18
4+
**Applies:** final storage decision ("D:-only project, no C: dependency")
5+
**Corrected plan:** `RAG_Platform_Master_Plan_v2.1.md` (new versioned file; `RAG_Platform_Master_Plan_v2.md` v2.0 preserved untouched, SHA256 `AF4114BD…486E5`)
6+
**Scope:** documentation-only correction. No Phase 0, no code, no dependencies, no Git, no models, no global settings changed. No architecture or milestone redesign — seven surgical edits, all inside v2.
7+
8+
---
9+
10+
## Exact edits (v2.0 → v2.1)
11+
12+
| # | Section | v2.0 wording (essence) | v2.1 wording (essence) | Why |
13+
|---|---|---|---|---|
14+
| 1 | Header (lines 3–8) | "version 2.0"; supersedes v1 | "version 2.1"; supersedes v2.0; new **Storage policy (final decision)** paragraph: D: is the workspace and destination for all project-generated data; C: is not a storage destination and its free space is not a readiness gate; existing C: tools may be read/executed, never relocated | Version the corrected plan; state the decision at the top |
15+
| 2 | §2 **Z9** | "All new artifacts on D: … C: must not grow." | Adds: logs, reports, Git metadata/worktrees, temp files, project interpreters enumerated; "C: free space is **not** a readiness gate — setup checks gate on D: destination sufficiency"; existing C: installations read/execute-only; no global installs | Make the D:-only rule exhaustive and remove any implied C: gate |
16+
| 3 | §10.2 Disk strategy | "setup script asserts C: free space and fails loud" | Destination-aware checks: D: writable + sufficient for the planned operation (fail loud with observed value); free-space snapshot recorded (D: primary, C: informational); **no C: free-space minimum**; unavoidable C:-writing tool limitation → disclose + stop for approval. D4 note updated (models stay on C:) | Remove the C: gate; replace with destination checks; disclosure path added |
17+
| 4 | §12 `setup.ps1` bullet | "asserts: C: free space ≥ 5 GB (fail loud), D: writable, …" | Destination-aware asserts: **D:** free space ≥ 10 GB working minimum before scaffold/venv (fail loud, observed value recorded) + D: writable; snapshot in setup report; **"There is no C: free-space gate"**; unavoidable C: requirement → disclose and stop for approval | The core removal (C: ≥ 5 GB). Destination-disk safety retained/strengthened on D: |
18+
| 5 | §13 **R6** mitigation | "C: overflow risk; C: free-space assert (v1 wording carried)" | Mitigation note updated: all project writes pinned to D:; setup gates on D: sufficiency, not a C: minimum | Keep the risk register consistent with the new guard |
19+
| 6 | §14 **D4** | "Optional: relocate `OLLAMA_MODELS` (9.2 GB) C: → D: (system env change)" | **Withdrawn** — existing installations/model stores are never relocated; models stay on C:, read-only use | Final decision forbids relocating existing model stores; decision list must not offer it |
20+
| 7 | §15 Phase 0 row + §16 DoD item 7 | "C:-space assert"; "C: did not grow … free-space deltas" | "destination-aware D:-space check (no C: gate)"; DoD 7 reworded as storage-policy verification ("no project activity wrote to C:" snapshots), explicitly "not a setup gate" | Cross-reference cleanup; DoD evidence retained as verification, not gate |
21+
22+
Also updated: directory tree in §11 (v2.0 marked historical, v2.1 marked "this document").
23+
24+
## What was deliberately NOT changed
25+
26+
- Architecture, milestones M1–M4, invariants I1–I13, evaluation methodology, BG-1 protocol (stop conditions, no-C:-dependency already held), zero-cost rules Z1–Z8/Z10–Z12, risks R15–R22, decisions D1–D3/D5–D11.
27+
- All original documents preserved: `RAG_Platform_Master_Plan.md` (v1), `RAG_Platform_Master_Plan_v2.md` (v2.0), `RAG_Platform_Strategy_Review.md`, `RAG_Platform_Plan_Diff.md`, `RAG_Platform_Preflight_Audit.md`, `RAG_Platform_Preflight_Audit_20261018-1654.md`.
28+
29+
## Note on the prior audit's H-2 finding
30+
31+
The preflight audit's H-2 proposed *keeping* the C: ≥ 5 GB threshold with `blocked`-semantics. The final decision supersedes that recommendation by removing the C: gate entirely; destination (D:) sufficiency checks and the disclosure-and-approval path for unavoidable C: tool operations replace it. No other audit finding is affected (H-1 BG-1 timing, H-3 pipeline ordering, M-1…M-5 remain as documented recommendations for a future correction pass; they are out of scope for this storage-only change).
32+
33+
*End of change note.*
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# RAG Platform — Plan Change Note v2.2
2+
3+
**Date:** 2026-10-18 (evidence time 17:32 +05:30)
4+
**Scope:** Documentation-only consistency pass on the master plan. Files created: `RAG_Platform_Master_Plan_v2.2.md` (this note's subject) and this change note. No implementation, no system changes.
5+
**Input documents reviewed:** `RAG_Platform_Master_Plan_v2.1.md`, `RAG_Platform_Plan_Change_Note_v2.1.md`, `RAG_Platform_Master_Plan_v2.md`, `RAG_Platform_Strategy_Review.md`, `RAG_Platform_Plan_Diff.md`, `RAG_Platform_Preflight_Audit.md` (historical), `RAG_Platform_Preflight_Audit_20261018-1654.md`.
6+
7+
## 1. Purpose
8+
9+
Resolve the two outstanding internal contradictions in plan v2.1 identified by the preflight audit (`RAG_Platform_Preflight_Audit_20261018-1654.md`):
10+
11+
- **H-1:** BG-1 benchmark sequencing — §10.3's heading said "run once at M1 start" while M1 gate 7 requires the report as an M1 exit criterion and §15 placed BG-1 in Phase 8 (after M1) — an unrunnable sequence.
12+
- **H-3:** Request-pipeline ordering — §4.2 listed `authz_filter` **before** `cache_lookup`, while §5's pipeline description had cache lookup **before** the authorization pre-filter — a security contradiction.
13+
14+
The v2.1 storage policy (final decision of 2026-10-18) is **preserved unchanged** (§2, Z9, §10.2, §12, §13/R6, §14/D4-withdrawn, Phase 0 row).
15+
16+
## 2. Exact changes (v2.1 → v2.2)
17+
18+
| # | Section | Change |
19+
|---|---------|--------|
20+
| 1 | Header | Document renamed/versioned to v2.2; supersession chain now v1→v2.0→v2.1→v2.2. |
21+
| 2 | §4.2 (item 2) | Stage list unchanged; added: budget selection is part of the `retrieval` stage; trace recording/failure attribution are cross-cutting recorders, not stages; explicit list of **mandatory security gates** vs **advisory diagnostics (never gates, I11)**. |
22+
| 3 | §5 diagram | Edges `API --> CACHE`, `API --> RET` changed to `AUTH --> CACHE`, `CACHE --> RET` so the graph matches the canonical order (cache is consulted only after authn + authz pre-filter). |
23+
| 4 | §5 pipeline paragraph | Rewritten as the canonical normative sequence matching §4.2 exactly: `authn → server-derived identity (I2) → authorization pre-filter → cache lookup (scoped + revalidated on hit) → budget → hybrid retrieval → post_verify → context_build → generation/abstention (I12) → ledger → response`; recorder cross-cutting; explicit rule "cache lookup never precedes the authorization pre-filter" and "a cache hit can never bypass current authorization"; mandatory gates vs advisory diagnostics listed. |
24+
| 5 | §10.3 | Split into **BG-1a — model-only baseline (Phase 0.5)** (steps 1–4, 6–8; proves the model verdict feeding D3 and Phase 6 generation defaults; evidence: dated Markdown+JSON report under `reports\` + verdict/measured numbers recorded in `docs/RESOURCE_BUDGET.md`) and **BG-1b — pipeline-unavailability proof (Phase 6)** (step 5; proves degraded retrieval-only mode end-to-end through the real pipeline; evidence: Phase 6 integration-test status in the M1 gate report; satisfies M1 gate 2). Added `blocked` (stop-condition abort) to the verdict enum so aborted runs are recorded honestly. |
25+
| 6 | §7.1 M1 scope | References BG-1a (Phase 0.5) and BG-1b (Phase 6) instead of one BG-1. |
26+
| 7 | §7.1 M1 gate 2 | Annotated as the BG-1b proof, executed at Phase 6. |
27+
| 8 | §7.1 M1 gate 7 | Now the **BG-1a** report (run at Phase 0.5); verdict enum aligned with §10.3 (`usable-cpu` / `usable-gpu(partial/full)` / `too-slow` / `too-heavy` / `blocked`-with-reason); states BG-1b is verified by gate 2, not gate 7. |
28+
| 9 | §14 D3 | "Post-BG-1**a** model verdict"; defer condition references BG-1a data. |
29+
| 10 | §15 phase table | New row **Phase 0.5** (BG-1a, depends only on Phase 0); Phase 6 row adds BG-1b proof; Phase 8 row drops BG-1 (was the mis-sequenced placement). |
30+
| 11 | §11 tree | `bench_model.ps1` labeled (BG-1a); v2.2 listed as current document, v2.1 marked historical. |
31+
32+
Chronological BG-1 sequence after this pass: **Phase 0 → BG-1a (model verdict, feeds D3 + Phase 6 defaults) → Phases 1–5 → Phase 6 (BG-1b degraded-mode proof) → Phase 8 (evals) → M1 gate check (gates 2 and 7)**. No benchmark results are claimed; nothing has been run.
33+
34+
## 3. Audit findings classification
35+
36+
- **Resolved in v2.1:** H-2 (C: ≥ 5 GB gate removed by the final storage decision; D: sufficiency ≥ 10 GB retained). Verified still absent in v2.2.
37+
- **Resolved in v2.2 (this pass):** H-1 (BG-1 sequencing), H-3 (pipeline ordering).
38+
- **Required before implementation, explicitly NOT resolved here (owner decision needed at D1 approval):**
39+
- **M-1** — operational log-sink destination on D: is not specified in the plan; setup.ps1 does not assert that `UV_CACHE_DIR`/`HF_HOME` resolve under D:.
40+
- **M-2** — concrete verification commands (FTS5, Qdrant load, egress) are not enumerated in the plan.
41+
- **M-3** — eval self-bias mitigations (frozen answer key, blind answer grading) are not required by the plan's acceptance criteria.
42+
- **M-4** — RAM-gate `blocked` vs `failed` semantics for tests are not fully specified. *Partially addressed:* BG-1a now has an explicit `blocked` verdict; general test-verdict semantics remain open.
43+
- **M-5** — Hugging Face offline flags (`HF_HUB_OFFLINE` et al.) and the offline test's tooling-egress scope are not stated.
44+
These are documented gaps, not silently "fixed"; folding them in is a small plan amendment or Phase 0 decision.
45+
- **Recommended but optional:** audit C-9-style label clarifications. The §5 diagram's `(I1)/(I2)/(I3)` node labels were checked and are **Innovation 1/2/3** (Evidence Ledger / Failure Observatory / Adaptive Budget), not invariants — no change needed.
46+
- **Intentionally deferred:** L-1 (DBHUB_DSN retarget), L-2 (opencode.jsonc coexistence), L-3 (OpenCode plugin load failures), L-4 (.ruff_cache under C:\Users\joelj\.cache), and unverified unknowns U1–U10 (each resolves during Phase 0 / BG-1a).
47+
48+
## 4. Verification performed
49+
50+
- **BG-1 grep (v2.2, 14 hits):** every reference consistent — §7.1 scope, gates 2/7, §10.3 split, scripts comment, D3, Phase 0.5/6 rows. No "M1 start" or Phase-8 BG-1 remains.
51+
- **Pipeline/cache grep (46 hits):** every cache mention follows the authorization pre-filter; §4.2 = §5 = diagram = M2/M4 gates = I1/I11/I12; no contradictory alternative sequence remains; recorder consistently cross-cutting, nine stages preserved.
52+
- **C:-gate grep (11 hits):** only "no C: gate" statements, the preserved D: ≥ 10 GB working minimum, and RAM (not disk) figures; no obsolete C: free-space requirement.
53+
- **Line diff v2.1 vs v2.2:** only the 11 regions in §2 changed; nothing else.
54+
- **v2.1 integrity:** SHA256 `7322AFE9B779A99FB368F80AC800DA71C37F59B27609FB91F3633D05444CB9EF` unchanged after creating v2.2; all historical files untouched.
55+
56+
## 5. Remaining unresolved issues
57+
58+
1. M-1 … M-5 (above) — documented as open, owner decision at D1.
59+
2. BG-1a `too-slow` floor is provisional (4 tok/s) and needs user confirmation before BG-1a runs.
60+
3. BG-1 evidence locations (`reports\` dated artifact + `docs/RESOURCE_BUDGET.md` entry) were not stated in v2.1; they are defined in v2.2 following existing plan conventions (gitignored `reports\` on D:, committed `docs\`).
61+
62+
No internal contradiction was found that could not be resolved from the existing source documents.
63+
64+
## 6. Boundaries observed
65+
66+
Documentation only. No Phase 0, no code, no setup scripts, no dependency installs, no Git init/state changes, no model downloads, no benchmarks, no tests executed, no global configuration changes, no external calls. All writes went to `D:\rag-platform`; nothing was written to `C:`. Checks performed were document searches and file comparisons only — no filesystem/benchmark/system verification is claimed. Implementation remains gated on explicit D1 approval.
67+
68+
**Files:**
69+
- `D:\rag-platform\RAG_Platform_Master_Plan_v2.2.md` (new canonical plan)
70+
- `D:\rag-platform\RAG_Platform_Plan_Change_Note_v2.2.md` (this note)

0 commit comments

Comments
 (0)