Repository navigation
Idea: give the AI that builds LifeOS a set of architecture principles, plus checks that enforce them #2476
Replies: 4 comments
|
+1 from a trial of 8.761.0. Your point 3 bit us directly: we run LifeOS from a test home, and with |
|
Correction to my earlier comment: LifeOS already has the resolver I suggested. I wrote a small codemod that routes 95 of those calls in 69 files through I also generated a map of the codebase from the code (each system by where its files really are, what a terminal session actually runs, folder pairs that import each other, file cycles, constants copied into 3+ files, empty catches), re-runnable after any update. Happy to share it. |
|
Your diagnosis matches what I kept running into with Claude Code on my own TypeScript projects: each change is reasonable locally, and nothing holds the overall shape. I built Architect for this (https://github.com/abhiramshaji-cyber/Architect). It keeps the intended structure in an architect.md file and exposes it over MCP, so the agent checks a proposed change against the rules before writing it, and its ranked function list shows which code the rest of the system leans on. It will not untangle the existing hooks/lib and TOOLS cross-imports by itself, and it is macOS only, but if you try it on your fork I would like to hear where the contract falls short. |
|
For the empty-catch point, I would distinguish optional enrichment from state needed by the next turn. A focused regression case: make the state directory unwritable, then verify that the next turn reports stale or unavailable state rather than treating the write as successful. That catches the user-visible failure without requiring every catch to become fatal. AI-assisted suggestion; no LifeOS execution claimed. |
Uh oh!
There was an error while loading. Please reload this page.
I use LifeOS every day and keep my own fork, so I read a lot of its code. The hardest part of working with it is the architecture. To change one thing safely I often have to read five or six folders, because knowledge that should live in one place is spread across many, and folders depend on each other in both directions.
My guess is that this comes from how the system grows. The AI fixes and extends it one task at a time. Each change is reasonable on its own, but nothing in its instructions asks it to keep the structure sound, so copies, shortcuts and cross-imports pile up.
All examples below are from
upstream/mainatb7efec97(v8.761.0). Paths are relative toLifeOS/install/.1.
hooks/libandLIFEOS/TOOLSdepend on each other103 files under
LIFEOS/andskills/import fromhooks/lib/, and 27 files inhooks/lib/import fromLIFEOS/TOOLS/. One loop:LIFEOS/TOOLS/lib/Boundary.ts:33importshooks/lib/label-redacthooks/lib/previous-reply.ts:9importsLIFEOS/TOOLS/lib/BoundaryIn practice
hooks/libis the shared library of the whole system, but its name says it belongs to the hooks. A change made there "for the hooks" reaches about a hundred files that are not hooks, and the two folders can only be changed and tested together.2. A regex copied by hand, next to an import that already exists
LIFEOS/TOOLS/lib/IsaClaims.ts:22says:// Byte-mirrors hooks/lib/isa-utils.ts CRITERIA_HEADING_RE. The same regex sits inhooks/lib/isa-utils.ts:196. Butisa-utils.ts:26already imports fromIsaClaims.ts, so the copy could be a single import. Today the two match only because someone remembers to edit both, and no test checks that they still match.3. Where is the memory system?
Cortex is one of the core systems, and it has no folder. 49 code files in 10 different folders refer to the knowledge archive: 25 in
LIFEOS/TOOLS, 9 inLIFEOS/PULSE, 6 inhooks, the rest in skills and otherLIFEOS/folders. The ones inLIFEOS/TOOLS/sit in one flat folder next to 337 other.tsfiles that have nothing to do with memory.The only map is the Components list in
LIFEOS/DOCUMENTATION/Memory/MemorySystem.md:147, and it points to the wrong place. It saysLIFEOS/PULSE/lib/lifeos-context.tsadds the memory blocks to the per-turn context. In a terminal session that file never runs: its only importer isPULSE/modules/siri.ts. The terminal gets its memory fromhooks/LoadMemory.hook.ts, which is not on the list.The two also build the same block separately.
lifeos-context.ts:61-63lists the two memory files and renders them;LoadMemory.hook.ts:116-117renders the same two files throughhooks/lib/progressive-memory.ts. A change to how memory is shown has to be made twice, in two folders, and the doc names only one of them.Even the location of the archive is written down 17 times.
KNOWLEDGE_DIR(or a twin) is defined separately inMemoryTypes.ts:48,MemoryRetriever.ts:83,KnowledgeGraph.ts:56,KnowledgeHarvester.ts:65,PULSE/modules/wiki.ts:44,hooks/KnowledgeWriteGuard.hook.ts:45and 11 more files, each built its own way (fromgetClaudeDir(),LIFEOS_DIR,MEMORY_DIR,userDataRoot(),HOMEand others).MemoryTypes.tsis the module meant to resolve storage paths (resolveStoragePath, line 460), but itsKNOWLEDGE_DIRisn't exported, so every other file defines its own.4. Top-level names that don't say what the folder does
LIFEOS/has 33 entries. Many are brand names:ASSAY,CENSVS,STATVS,VIGIL,VERA,SOCRATES,MAESTRO,ERRATA,RINGS,RELAY,AS3. A newcomer, human or model, can't tell from the tree what the system does or where a given job lives, and has to open each folder to find out.5. Failures that disappear
There are 58 empty
catch {}blocks inhooks/. Some are fine (pausing stdin). Others hide real failures:hooks/AlgorithmNudge.hook.ts:318-324(saveState) drops a failed state write with no trace, so the next run starts from the wrong state and nobody can see why.The idea
Give the AI that builds LifeOS a short architecture reference that it must read before any structural change (new module, moved code, new folder), and back the parts that can be checked with checks that run on every commit. Roughly:
One place per piece of knowledge. A format, rule or list that several modules need lives in one module that the others import. Hand-kept copies are not allowed. (Would fix 2, and the duplicates in 3.)
Dependencies point one way. Shared code lives in a folder named for what it is (e.g.
LIFEOS/lib/), and hooks, tools, Pulse and skills import from it. Nothing reaches into another module's internals. A dependency check in CI would block cycles like 1.Each system has a home, and names say the job. A core system like Cortex lives in one folder whose README lists its parts, and a folder's name says what it does, so the tree itself is the map of the system. (Would fix 3 and 4.)
No silent failures. An error is either handled on purpose or written somewhere a person will see it. A lint rule against empty
catchblocks, with an explicit opt-out comment, would catch most of 5.Most of this comes from John Ousterhout's A Philosophy of Software Design (information hiding, change amplification) and David Parnas's 1972 paper on decomposing systems into modules. The rules are old. What would be new is making them part of the instructions LifeOS gives its own builder, the same way ISAs make "done" explicit for every task.
All reactions