@floless/app 0.85.0 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +2001 -711
- package/dist/schemas/steel.takeoff.v1.schema.json +34 -4
- package/dist/skills/floless-app-knowledge/SKILL.md +206 -0
- package/dist/skills/floless-app-knowledge/references/schema.md +132 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +380 -28
- package/dist/skills/floless-app-workflows/SKILL.md +33 -7
- package/dist/skills/floless-app-workflows/references/dev-server-and-run-trace.md +2 -1
- package/dist/skills/floless-app-workflows/references/exec-contract.md +1 -1
- package/dist/skills/floless-app-workflows/references/workspace-data.md +111 -0
- package/dist/skills/reading-structural-drawings/SKILL.md +102 -1
- package/dist/skills/steel-drawing-abbreviations/SKILL.md +33 -1
- package/dist/templates/floless-workspace-read.flo +161 -0
- package/dist/web/app.css +312 -14
- package/dist/web/aware.js +327 -43
- package/dist/web/grid-core.js +40 -6
- package/dist/web/index.html +49 -11
- package/dist/web/steel-3d-view.js +117 -20
- package/dist/web/steel-editor.html +1424 -294
- package/dist/web/steel-filter.html +3 -1
- package/dist/web/vector-3d.html +3 -3
- package/dist/web/vector-editor.html +12 -5
- package/dist/web/workspaces.js +1083 -100
- package/package.json +1 -1
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"sheet_previews": { "type": "object", "additionalProperties": { "type": "string" }, "description": "sheet -> base64 JPEG full-sheet preview (title block excluded)." },
|
|
17
17
|
"custom_details": { "type": "object", "additionalProperties": { "type": "string" }, "description": "user-created detail name -> base64 JPEG." },
|
|
18
18
|
"moment_frames": { "type": "array", "description": "Moment-frame schedule from the frame-elevation sheets." },
|
|
19
|
+
"read_notes": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": { "type": "string" },
|
|
22
|
+
"description": "Plain-English notes the reader records about what it could NOT resolve — an ambiguous label, a member it cannot place, an unsupported brace topology. An unplaceable member has no work-points, so it cannot be a member at all (`wp` is required), and an `rfi` member with a resolved profile would still enter the BOM; a note here is the honest carrier. The reader rebuilds these from the source on every read (stale entries are dropped, not carried forward) and states them in its hand-off."
|
|
23
|
+
},
|
|
19
24
|
"detail_bubbles": {
|
|
20
25
|
"type": "object",
|
|
21
26
|
"additionalProperties": {
|
|
@@ -73,11 +78,23 @@
|
|
|
73
78
|
},
|
|
74
79
|
"additionalProperties": true
|
|
75
80
|
},
|
|
81
|
+
"gridLine": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"required": ["id", "label", "a", "b"],
|
|
84
|
+
"additionalProperties": true,
|
|
85
|
+
"description": "One standalone structural grid/reference line, including skewed or partial lines that do not belong to the orthogonal X/Y spacing family.",
|
|
86
|
+
"properties": {
|
|
87
|
+
"id": { "type": "string", "description": "Stable id for editing and 3D snap provenance." },
|
|
88
|
+
"label": { "type": "string", "description": "Bubble text shown at both ends." },
|
|
89
|
+
"a": { "$ref": "#/$defs/point2", "description": "First endpoint in this plan's display space." },
|
|
90
|
+
"b": { "$ref": "#/$defs/point2", "description": "Second endpoint in this plan's display space." }
|
|
91
|
+
}
|
|
92
|
+
},
|
|
76
93
|
"grid": {
|
|
77
94
|
"type": ["object", "null"],
|
|
78
95
|
"required": ["origin"],
|
|
79
96
|
"additionalProperties": true,
|
|
80
|
-
"description": "Structural grid: X/Y are RELATIVE spacing strings (
|
|
97
|
+
"description": "Structural grid: X/Y are RELATIVE spacing strings (compact bay syntax — \"0 3*25' 20'-6\\\"\", n*d repeats a bay; tokens accept ft-in / inches / m / bare mm), Z is ABSOLUTE elevations. X entries space lines along +X (lines vertical on the plan, auto-labels 1,2,3…); Y entries march UP the sheet (lines horizontal, auto-labels A,B,C…). web/grid-core.js is the parser/geometry source of truth.",
|
|
81
98
|
"properties": {
|
|
82
99
|
"on": { "type": "boolean", "description": "Grid visible (2D + 3D). Default true." },
|
|
83
100
|
"origin": { "$ref": "#/$defs/point2", "description": "The [1,A] corner, display space (same space as member wp)." },
|
|
@@ -88,7 +105,8 @@
|
|
|
88
105
|
"labels_y": { "type": "string", "description": "Whitespace-separated label overrides for Y lines; blank = auto A,B,C…" },
|
|
89
106
|
"ext": { "type": "number", "description": "How far lines run past the outermost line, in mm. Default 5'." },
|
|
90
107
|
"ends_x": { "type": "object", "description": "Per-line extent overrides for X lines: { \"<line index>\": [lo, hi] } display px along the line (a partial line like a 5.1 insert covering one wing). null / absent element = the auto full span. Set by dragging a bubble along its line." },
|
|
91
|
-
"ends_y": { "type": "object", "description": "Per-line extent overrides for Y lines — same shape as ends_x." }
|
|
108
|
+
"ends_y": { "type": "object", "description": "Per-line extent overrides for Y lines — same shape as ends_x." },
|
|
109
|
+
"lines": { "type": "array", "items": { "$ref": "#/$defs/gridLine" }, "description": "Standalone free-angle grid/reference lines. Endpoints are display-space points, same as member work-points and dimensions." }
|
|
92
110
|
}
|
|
93
111
|
},
|
|
94
112
|
"filter": {
|
|
@@ -310,7 +328,7 @@
|
|
|
310
328
|
"members": { "type": "array", "items": { "$ref": "#/$defs/member" } },
|
|
311
329
|
"dims": { "type": "array", "items": { "$ref": "#/$defs/dim" }, "description": "Draft-only on-drawing dimensions (editor annotations). NOT baked into the lock / 3D / IFC / BOM." },
|
|
312
330
|
"frame": { "$ref": "#/$defs/frame" },
|
|
313
|
-
"grid": { "$ref": "#/$defs/grid", "description": "Structural grid lines
|
|
331
|
+
"grid": { "$ref": "#/$defs/grid", "description": "Structural grid lines. PER-PLAN — its origin/spacings live in this sheet's display space (like frame/dims). A plan REFERENCE the editor renders in 2D + 3D and snaps to — it never constrains members and is NOT baked into the lock / IFC / BOM." }
|
|
314
332
|
}
|
|
315
333
|
},
|
|
316
334
|
"segment": {
|
|
@@ -423,9 +441,21 @@
|
|
|
423
441
|
},
|
|
424
442
|
"angle": { "enum": ["H", "V", "D"] },
|
|
425
443
|
"role": { "enum": ["beam", "column"], "description": "Defaults to beam when absent." },
|
|
426
|
-
"position": { "enum": ["top", "middle", "bottom"], "description": "Profile placement relative to the reference line (the work-line between the two work-points)
|
|
444
|
+
"position": { "enum": ["top", "middle", "bottom"], "description": "Profile placement relative to the reference line (the work-line between the two work-points) — the section's depth position. top = line at the section top (steel hangs below); middle = line through the centroid; bottom = line at the section bottom. When absent the editor defaults a flat beam to top (line = top of steel), and a column, a VERTICAL brace (whatever its slope — its work-points sit on the column centre-lines) or a steep beam to middle." },
|
|
427
445
|
"rfi": { "type": "boolean", "description": "True when the size is unresolved (excluded from the BOM)." },
|
|
428
446
|
"mf": { "type": "boolean", "description": "Moment-frame member (persistent flag)." },
|
|
447
|
+
"memberType": { "type": "string", "description": "Member category driving the legend (e.g. beam, ledger, brace). 'brace' is special: the member draws with the brace symbology and is excluded from every beam-only path (merge, reversed-beams, shear plates)." },
|
|
448
|
+
"brace": {
|
|
449
|
+
"type": "object",
|
|
450
|
+
"description": "Brace symbology — present only when memberType is 'brace'. `floor` and `offset` are 2D-PLAN DISPLAY ONLY: the 3D bake, IFC and Tekla export always use the member's true wp + end TOS.",
|
|
451
|
+
"properties": {
|
|
452
|
+
"type": { "enum": ["lateral", "vertical"], "description": "vertical = diagonal frame bracing spanning two column centre-lines (symbol drawn offset). lateral = a kicker between beams (drawn at its true work-points, never offset)." },
|
|
453
|
+
"floor": { "enum": ["above", "below"], "description": "Vertical braces only. above = continuous line; below = dashed line." },
|
|
454
|
+
"offset": { "type": "number", "description": "Vertical braces only. Signed perpendicular distance (INCHES) from the work-point line to the DRAWN symbol line; a negative value draws it on the other side. Display-only — it never moves the work-points." },
|
|
455
|
+
"lowerEnd": { "enum": [0, 1], "description": "Optional override of which work-point is the lower (double-arrowhead) end. Absent = derived from the ends' effective TOS (tie -> end 0)." }
|
|
456
|
+
},
|
|
457
|
+
"additionalProperties": false
|
|
458
|
+
},
|
|
429
459
|
"ends": {
|
|
430
460
|
"type": "array",
|
|
431
461
|
"items": { "$ref": "#/$defs/end" },
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: floless-app-knowledge
|
|
3
|
+
description: This skill should be used when there is a pending floless `knowledge-organize` or `knowledge-adjust` request — the user pressed Organize on a floless.app project's Knowledge step, or asked to reshape that project's knowledge base. Also triggers on asks like "organize my project knowledge base", "compile the project wiki", "drain my knowledge-organize request", or "fold these shop standards into the project's knowledge". It teaches the host AI to claim the server-owned organize lock, project the enabled reference sources into that project's vault, compile a cross-linked LLM-wiki into the server-minted generation directory, and publish it — never writing the server-owned manifest, pointer, or lock.
|
|
4
|
+
metadata:
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Organize a project's Knowledge Base
|
|
9
|
+
|
|
10
|
+
## What this is
|
|
11
|
+
|
|
12
|
+
A floless.app **project** is a job with a context. The user drops references into the project's
|
|
13
|
+
**Knowledge** step — company standards, a fabricator's shop preferences, spec sections, RFIs, past
|
|
14
|
+
jobs — and presses **Organize**. That queues a `knowledge-organize` request for the terminal AI.
|
|
15
|
+
|
|
16
|
+
This skill drains that request: read the enabled sources, compile them into a project-scoped
|
|
17
|
+
**LLM-wiki**, and publish it. Everything else working on the project (the reader, the connection
|
|
18
|
+
engine, the drawing generator) then consults that wiki as project context.
|
|
19
|
+
|
|
20
|
+
**The UI never parses a source or edits the wiki.** That is this skill's job, at compose time.
|
|
21
|
+
|
|
22
|
+
**The server owns integrity** — the single-flight lock, the manifest, the immutable generations, and
|
|
23
|
+
the atomic publish. Drive it through the lifecycle routes below, never by writing its files.
|
|
24
|
+
|
|
25
|
+
## Resolve the knowledge base
|
|
26
|
+
|
|
27
|
+
The request carries the project id (`req.project`). Derive paths in Node terms, never shell:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const home = process.env.FLOLESS_HOME ?? path.join(os.homedir(), '.floless');
|
|
31
|
+
const knowledge = path.join(home, 'projects', projectId, 'knowledge');
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Read `references/schema.md` before compiling. It is the **forked** project-KB schema — in it
|
|
35
|
+
`manifest.json` is truth and `raw/` is a rebuilt projection, the inverse of a generic vault. Copy it
|
|
36
|
+
to `<knowledge>/vault/schema.md` on the first pass; read it from there afterwards.
|
|
37
|
+
|
|
38
|
+
The base URL is the floless origin embedded in the copied request marker (typically
|
|
39
|
+
`http://127.0.0.1:4317`). Confirm queued work with `GET <base>/api/requests`.
|
|
40
|
+
|
|
41
|
+
## The lifecycle — server-owned, do not improvise
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
POST <base>/api/projects/<projectId>/knowledge/requests/<requestId>/start
|
|
45
|
+
→ { baseRevision, generationId, wikiDir } claims the lock; mints the generation dir
|
|
46
|
+
… compile into wikiDir …
|
|
47
|
+
POST <base>/api/projects/<projectId>/knowledge/requests/<requestId>/finish
|
|
48
|
+
body { generationId, lintSummary } publishes the generation; clears the request
|
|
49
|
+
POST <base>/api/projects/<projectId>/knowledge/requests/<requestId>/fail
|
|
50
|
+
body { error } releases the lock; marks the sources errored
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Non-negotiables:
|
|
54
|
+
|
|
55
|
+
- **Never `DELETE /api/requests/<requestId>`.** `finish`/`fail` clears it. A stray delete strands the
|
|
56
|
+
organize lock until its 10-minute stale timeout, and the KB looks frozen to the user.
|
|
57
|
+
- **Compile only into the `wikiDir` that `start` returned.** Never invent or guess a generation path;
|
|
58
|
+
`generationId` is server-minted.
|
|
59
|
+
- **Exactly one `finish` or one `fail` per `start`.** On any error — an unreadable source, a failed
|
|
60
|
+
compile, an aborted run — call `fail` with a plain-English `error` so the lock is released and the
|
|
61
|
+
user sees why. Never leave a claimed pass dangling.
|
|
62
|
+
- **Never write** `manifest.json`, `current-generation.json`, `lock.json`, or `organize.json`. They
|
|
63
|
+
are server-owned. `blobs/` is read-only.
|
|
64
|
+
|
|
65
|
+
### Drift — when `finish` returns `{ rerun: true }`
|
|
66
|
+
|
|
67
|
+
The user toggled or dropped a source while the pass was running, so the published wiki no longer
|
|
68
|
+
reflects the committed source set. The finished request is already consumed, so it cannot be
|
|
69
|
+
re-driven. Instead:
|
|
70
|
+
|
|
71
|
+
1. `POST <base>/api/projects/<projectId>/knowledge/organize` → a **fresh** request.
|
|
72
|
+
2. Run `start` → compile → `finish` on that new id **exactly once**.
|
|
73
|
+
|
|
74
|
+
Do not loop. One re-run settles it; a second `rerun: true` means the user is still editing, so stop
|
|
75
|
+
and say so.
|
|
76
|
+
|
|
77
|
+
## Procedure
|
|
78
|
+
|
|
79
|
+
### 1. Claim the pass
|
|
80
|
+
|
|
81
|
+
`POST …/start`. Keep `baseRevision`, `generationId`, and `wikiDir`.
|
|
82
|
+
|
|
83
|
+
### 2. Snapshot the source set
|
|
84
|
+
|
|
85
|
+
`GET <base>/api/projects/<projectId>/knowledge/status`. The rows the store just marked
|
|
86
|
+
`state: "organizing"` **are this pass's snapshot** — compile from those, not from a re-read
|
|
87
|
+
"currently enabled" set that can move underneath the pass. Drift after `start` is handled by
|
|
88
|
+
`rerun`, not by re-reading.
|
|
89
|
+
|
|
90
|
+
Each row carries `sourceId`, `blobSha256`, `filename`, `mime`, `bytes`, `kind`, `useAsKb`, `state`.
|
|
91
|
+
It does **not** carry a path. Read each source's bytes from
|
|
92
|
+
`path.join(knowledge, 'blobs', row.blobSha256)`, after asserting the resolved path stays under
|
|
93
|
+
`<knowledge>/blobs/`.
|
|
94
|
+
|
|
95
|
+
Binaries (PDF, images) are read with vision/extraction **here, at compose time** — the wiki only ever
|
|
96
|
+
stores a size-limited markdown summary, never the bytes.
|
|
97
|
+
|
|
98
|
+
### 3. Drain the inbox
|
|
99
|
+
|
|
100
|
+
For each unprocessed line in `<knowledge>/vault/inbox.md`:
|
|
101
|
+
|
|
102
|
+
- Belongs on an existing wiki page → append it there, **below the `<!-- vault:generated:end -->`
|
|
103
|
+
marker** so the next compile never overwrites it.
|
|
104
|
+
- Is a real observation worth keeping → promote it to
|
|
105
|
+
`vault/raw/observations/<YYYY-MM-DD>-<slug>.md` (durable; a later compile mints its wiki page).
|
|
106
|
+
- Trivial → drop it, and say so.
|
|
107
|
+
|
|
108
|
+
Move handled lines under a `## Processed` heading at the bottom. Re-running must be idempotent.
|
|
109
|
+
Never mint a `wiki/` page here.
|
|
110
|
+
|
|
111
|
+
### 4. Rebuild the raw projection
|
|
112
|
+
|
|
113
|
+
This is the step that makes toggling a source **actually** take effect.
|
|
114
|
+
|
|
115
|
+
- `vault/raw/sources/` — **delete every page that does not correspond to a source in this pass's
|
|
116
|
+
enabled snapshot**, then write one page per enabled source (frontmatter per `schema.md`: `type`,
|
|
117
|
+
`source_id`, `blob_sha256`, `filename`, `captured`; body = the extracted markdown).
|
|
118
|
+
- `vault/raw/observations/` — **leave alone.** These are durable truth. A source recompile that
|
|
119
|
+
deletes them destroys the user's accumulated notes.
|
|
120
|
+
|
|
121
|
+
### 5. Compile the wiki into `wikiDir`
|
|
122
|
+
|
|
123
|
+
1. Inventory `vault/raw/sources/**` and `vault/raw/observations/**`.
|
|
124
|
+
2. For each, write `wikiDir/sources/<slug>.md` — a concise summary, the key points, and
|
|
125
|
+
`[[wikilinks]]` to every concept and person it touches. Generated prose goes inside the
|
|
126
|
+
`<!-- vault:generated:start -->` / `<!-- vault:generated:end -->` fence.
|
|
127
|
+
3. Mint or extend `wikiDir/concepts/<slug>.md` and `wikiDir/people/<slug>.md` for recurring ideas,
|
|
128
|
+
terms, systems, and named people or organizations. Cross-link both ways — a concept page lists the
|
|
129
|
+
sources that mention it.
|
|
130
|
+
4. Write `wikiDir/index.md` as a map of content grouped by type. **It must exist and be non-empty in
|
|
131
|
+
every generation**, including an empty knowledge base — publishing an empty generation is a broken
|
|
132
|
+
KB. If the enabled set is empty, still write an index that says so.
|
|
133
|
+
|
|
134
|
+
Surface conflicts rather than silently resolving them: if an RFI supersedes a standard, say which
|
|
135
|
+
governs and cite both.
|
|
136
|
+
|
|
137
|
+
### 6. Lint, then publish
|
|
138
|
+
|
|
139
|
+
Check the compiled `wikiDir` for broken `[[links]]`, duplicate slugs, orphan pages (no inbound link,
|
|
140
|
+
excluding `index.md`), and sources with no page. Strip fenced and inline code before extracting links
|
|
141
|
+
— example links in backticks are documentation, not real links. Auto-fix only mechanically-safe
|
|
142
|
+
issues (a clearly renamed link target); report the judgemental ones.
|
|
143
|
+
|
|
144
|
+
Then `POST …/finish` with `{ generationId, lintSummary }`, where `lintSummary` is one short line the
|
|
145
|
+
UI shows next to the published generation, e.g. `12 notes · 8 links · 1 orphan`.
|
|
146
|
+
|
|
147
|
+
Handle `{ rerun: true }` as above.
|
|
148
|
+
|
|
149
|
+
## Adjust requests (`knowledge-adjust`)
|
|
150
|
+
|
|
151
|
+
The request carries the user's prose in `instruction` — for example "treat RFI-014 as governing" or
|
|
152
|
+
"merge the two standards". Apply it by editing the vault, not by arguing with the manifest:
|
|
153
|
+
|
|
154
|
+
- A durable steer belongs in `vault/raw/observations/` so a later recompile cannot lose it.
|
|
155
|
+
- Then organize (queue `…/knowledge/organize` and drain it) so the published generation reflects the
|
|
156
|
+
change.
|
|
157
|
+
- A `knowledge-adjust` request is an ordinary request — apply it, then `DELETE
|
|
158
|
+
<base>/api/requests/<requestId>`. Only `knowledge-organize` is lifecycle-cleared.
|
|
159
|
+
|
|
160
|
+
## Consulting the KB from other work
|
|
161
|
+
|
|
162
|
+
When any other task on this project dispatches a subagent that should honor the knowledge base, pass
|
|
163
|
+
`{ projectId, workspaceBaseUrl }` into the subagent's prompt. A subagent cannot consult a KB it
|
|
164
|
+
cannot name. Thread the **identity**, not the KB contents.
|
|
165
|
+
|
|
166
|
+
## Happy path (end to end)
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
BASE=http://127.0.0.1:4317
|
|
170
|
+
P=<projectId>
|
|
171
|
+
|
|
172
|
+
# 0. What is queued? (the Organize button created this)
|
|
173
|
+
curl -s $BASE/api/requests | jq '.requests[] | select(.type=="knowledge-organize")'
|
|
174
|
+
R=<requestId>
|
|
175
|
+
|
|
176
|
+
# 1. Claim the pass — returns baseRevision, generationId, wikiDir
|
|
177
|
+
curl -s -X POST $BASE/api/projects/$P/knowledge/requests/$R/start
|
|
178
|
+
|
|
179
|
+
# 2. Read the snapshot (rows now state:"organizing") and their blobs
|
|
180
|
+
curl -s $BASE/api/projects/$P/knowledge/status | jq '.manifest.sources'
|
|
181
|
+
# bytes live at ~/.floless/projects/$P/knowledge/blobs/<blobSha256>
|
|
182
|
+
|
|
183
|
+
# 3. …drain inbox, rebuild raw/sources, compile the wiki INTO the returned wikiDir…
|
|
184
|
+
|
|
185
|
+
# 4. Publish (clears the request; never DELETE it)
|
|
186
|
+
curl -s -X POST $BASE/api/projects/$P/knowledge/requests/$R/finish \
|
|
187
|
+
-H 'content-type: application/json' \
|
|
188
|
+
-d '{"generationId":"<the one start returned>","lintSummary":"12 notes, 8 links"}'
|
|
189
|
+
# → { ok: true, rerun: false } ... rerun:true ⇒ POST …/knowledge/organize once and redo
|
|
190
|
+
#
|
|
191
|
+
# NOTE: keep an inline -d body ASCII. Some Windows shells re-encode a non-ASCII argument, so the
|
|
192
|
+
# byte count stops matching Content-Length and the server rejects it with
|
|
193
|
+
# "Request body size did not match Content-Length". To send a summary containing "·" or any
|
|
194
|
+
# non-ASCII text, write the JSON to a UTF-8 file and post that instead:
|
|
195
|
+
# curl -s -X POST .../finish -H 'content-type: application/json' --data-binary @finish.json
|
|
196
|
+
|
|
197
|
+
# on any failure instead:
|
|
198
|
+
curl -s -X POST $BASE/api/projects/$P/knowledge/requests/$R/fail \
|
|
199
|
+
-H 'content-type: application/json' -d '{"error":"could not read RFI-014.pdf"}'
|
|
200
|
+
|
|
201
|
+
# 5. Confirm: currentGeneration set, sources flipped to "organized"
|
|
202
|
+
curl -s $BASE/api/projects/$P/knowledge/status | jq '{gen:.currentGeneration, states:[.manifest.sources[].state]}'
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Finish by telling the user, in plain English, what was organized — how many notes and links, what the
|
|
206
|
+
knowledge base now asserts, and anything that conflicted.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Project Knowledge Base — vault schema
|
|
2
|
+
|
|
3
|
+
This is the contract for a **floless.app project's** knowledge base. It is a deliberate **fork** of
|
|
4
|
+
the generic LLM-wiki vault schema, not a copy: the two invert what counts as truth.
|
|
5
|
+
|
|
6
|
+
> Copy this file to `<knowledge>/vault/schema.md` on the first organize pass, then read it from there
|
|
7
|
+
> on later passes (a user may have annotated it).
|
|
8
|
+
|
|
9
|
+
## The one thing to get right
|
|
10
|
+
|
|
11
|
+
| | Generic vault | **This project KB** |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Truth | `raw/` is immutable truth | **`manifest.json` is truth** |
|
|
14
|
+
| `raw/` | the source of truth | a **rebuilt projection** of the enabled sources |
|
|
15
|
+
| `wiki/` | generated, edited in place | generated into an **immutable generation**, published by pointer |
|
|
16
|
+
|
|
17
|
+
`manifest.json` (server-owned — **never write it**) holds the source rows the user dropped and
|
|
18
|
+
toggled. `raw/` is a working projection the compiler reads. If the two disagree, the manifest wins,
|
|
19
|
+
and `raw/` gets rebuilt.
|
|
20
|
+
|
|
21
|
+
## Layout
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
<knowledge>/ ~/.floless/projects/<projectId>/knowledge/
|
|
25
|
+
manifest.json SERVER-OWNED truth: { revision, currentGeneration, sources[] }
|
|
26
|
+
blobs/<sha256> content-addressed dropped bytes (read-only to you)
|
|
27
|
+
organize.json lock.json SERVER-OWNED lifecycle bookkeeping — never touch
|
|
28
|
+
vault/
|
|
29
|
+
schema.md this file
|
|
30
|
+
inbox.md fleeting one-liners, drained before compiling
|
|
31
|
+
raw/
|
|
32
|
+
sources/<slug>.md PROJECTION — rebuilt every pass from the ENABLED sources
|
|
33
|
+
observations/<date>-<slug>.md DURABLE truth — user/AI notes; a source recompile never deletes these
|
|
34
|
+
generations/<generationId>/wiki/ IMMUTABLE published wiki (compile writes here, once)
|
|
35
|
+
current-generation.json SERVER-OWNED pointer — never write it; `finish` flips it
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`<knowledge>` resolves as `path.join(process.env.FLOLESS_HOME ?? path.join(os.homedir(), '.floless'),
|
|
39
|
+
'projects', projectId, 'knowledge')`. Always resolve a blob path and assert it stays under
|
|
40
|
+
`<knowledge>/blobs/` before reading it.
|
|
41
|
+
|
|
42
|
+
## `raw/` is two namespaces, and only one is rebuilt
|
|
43
|
+
|
|
44
|
+
- **`raw/sources/`** — one page per **enabled** source row. **Delete any file here that no longer
|
|
45
|
+
corresponds to an enabled source**, then re-project the pass's snapshot. This is what makes a
|
|
46
|
+
toggled-off or removed reference actually stop influencing the wiki.
|
|
47
|
+
- **`raw/observations/`** — durable first-party notes. **Never deleted by a source recompile.**
|
|
48
|
+
Rebuilt only from observation truth (`kind:"observation"` rows + `inbox.md` promotions).
|
|
49
|
+
|
|
50
|
+
Losing this distinction is the classic bug: a blanket `raw/` wipe silently destroys the user's
|
|
51
|
+
accumulated notes.
|
|
52
|
+
|
|
53
|
+
## Naming
|
|
54
|
+
|
|
55
|
+
- **Slug:** lowercase ASCII; spaces and punctuation collapse to single hyphens; trimmed; max ~60
|
|
56
|
+
chars; derived from the page title. Must match `^[a-z0-9][a-z0-9-]*$`.
|
|
57
|
+
- Collision: append `-2`, `-3`, …
|
|
58
|
+
- `raw/observations/` filenames carry a date prefix: `YYYY-MM-DD-<slug>.md`.
|
|
59
|
+
- `raw/sources/` and `wiki/**` filenames are `<slug>.md` (no date — pages evolve).
|
|
60
|
+
|
|
61
|
+
## Frontmatter
|
|
62
|
+
|
|
63
|
+
Raw source projection page:
|
|
64
|
+
```yaml
|
|
65
|
+
---
|
|
66
|
+
type: source
|
|
67
|
+
source_id: 7c1e… # SourceRow.sourceId — the row identity
|
|
68
|
+
blob_sha256: 9af3… # content address of the bytes
|
|
69
|
+
filename: ACME shop standards.pdf
|
|
70
|
+
captured: 2026-07-09
|
|
71
|
+
tags: []
|
|
72
|
+
---
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Observation page:
|
|
76
|
+
```yaml
|
|
77
|
+
---
|
|
78
|
+
type: observation
|
|
79
|
+
captured: 2026-07-09
|
|
80
|
+
title: RFI-014 governs the grid-B shear tab
|
|
81
|
+
tags: []
|
|
82
|
+
---
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Wiki page:
|
|
86
|
+
```yaml
|
|
87
|
+
---
|
|
88
|
+
type: source # source | concept | person | index
|
|
89
|
+
generated: 2026-07-09
|
|
90
|
+
sources: ["[[acme-shop-standards]]"] # provenance — the raw pages this derives from
|
|
91
|
+
tags: []
|
|
92
|
+
---
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`type` drives the graph's node colors in a later slice, so use exactly these four values.
|
|
96
|
+
|
|
97
|
+
## Generated-section markers (load-bearing)
|
|
98
|
+
|
|
99
|
+
Generated prose lives inside this fence. A recompile replaces **only** what is inside it; anything
|
|
100
|
+
outside survives, so a user's hand edits and any notes appended below the fence are safe:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
<!-- vault:generated:start -->
|
|
104
|
+
…compiled content…
|
|
105
|
+
<!-- vault:generated:end -->
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Linking
|
|
109
|
+
|
|
110
|
+
- `[[wikilinks]]` reference a page by filename without extension: `[[a325-bolts]]`.
|
|
111
|
+
- Wiki source pages link back to their `raw/` provenance.
|
|
112
|
+
- Concept and person pages list the sources that mention them.
|
|
113
|
+
- `wiki/index.md` links to every major page and is the graph's root node.
|
|
114
|
+
|
|
115
|
+
## Wiki shape a compile must produce
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
wiki/
|
|
119
|
+
index.md map of content; ALWAYS present, even for an empty KB
|
|
120
|
+
sources/<slug>.md one summary page per enabled source
|
|
121
|
+
concepts/<slug>.md recurring ideas, terms, systems
|
|
122
|
+
people/<slug>.md named people and organizations
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`index.md` must exist and be non-empty in every generation — `finish` publishes a generation, and an
|
|
126
|
+
empty one is a broken knowledge base.
|
|
127
|
+
|
|
128
|
+
## Write-ordering contract
|
|
129
|
+
|
|
130
|
+
Drain `inbox.md` → rebuild `raw/sources/` → compile `wiki/` → lint. Inbox draining may append to an
|
|
131
|
+
existing wiki page (below the fence) or promote a note to `raw/observations/`; it never mints a new
|
|
132
|
+
wiki page. Only the compile step mints pages, so the two writers never race on the same file.
|