ai-first-os 2.1.2 → 2.2.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/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="assets/ai-first-os-logo.svg" alt="AI First OS" width="480">
3
+ </p>
4
+
1
5
  # AI First OS
2
6
 
3
7
  Latest version and what changed in it: [Releases](https://github.com/pedroromeroluna/ai-first-os/releases) · [CHANGELOG.md](CHANGELOG.md).
@@ -92,17 +96,20 @@ Paste this to your agent:
92
96
  > Update the system.
93
97
 
94
98
  That sentence is enough, and **this is the only place that says what it does** — the manual in your
95
- brain and the bootstrap skill point here instead of telling the story again. The tools come from two
96
- places, so updating them has two halves and both run:
99
+ brain and the bootstrap skill point here instead of telling the story again. The update has three
100
+ parts, and each one runs only when it applies:
97
101
 
98
102
  1. **The system.** The agent goes to the local folder where the repository ended up, brings down the
99
103
  newest version and runs `core/install.sh` from that folder.
100
104
  2. **The pack**, if you installed it. The agent runs
101
105
  `npx --yes skills add pedroromeroluna/ai-first-product-skills --agent claude-code --yes` again, which replaces the skills in
102
106
  `.claude/skills/` with the published version. With no pack installed there is nothing to refresh, and this half is skipped.
107
+ 3. **The Obsidian look.** The agent runs `.os/core/lib/obsidian-look.sh --brain .` from your brain. A brain that
108
+ already has the look gets the new version of its style files, without being asked. A brain that never
109
+ answered is asked once. A brain that said no is left alone.
103
110
 
104
111
  Your brain —your workspaces, your decisions, your content— is not touched: the update only
105
- refreshes the tools. And if the installer were run by mistake through the hook that is already
112
+ refreshes the tools and, if you took it, the style files of the Obsidian look. And if the installer were run by mistake through the hook that is already
106
113
  installed, it stops on its own with a message before writing anything.
107
114
 
108
115
  ## Layout
@@ -0,0 +1,15 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 680 120" width="680" height="120" role="img" aria-label="AI First OS">
2
+ <title>AI First OS</title>
3
+ <g fill="#8fd0ff"><rect x="10" y="0" width="50" height="20"/><rect x="80" y="0" width="20" height="20"/><rect x="130" y="0" width="70" height="20"/><rect x="210" y="0" width="20" height="20"/><rect x="240" y="0" width="60" height="20"/><rect x="320" y="0" width="70" height="20"/><rect x="400" y="0" width="80" height="20"/><rect x="520" y="0" width="60" height="20"/><rect x="600" y="0" width="70" height="20"/></g>
4
+ <path fill="none" stroke="#4f728c" stroke-width="1.6" stroke-linecap="square" d="M60 7L67 7M67 7L67 20M60 13L63 13M63 13L63 20M100 7L107 7M107 7L107 20M100 13L103 13M103 13L103 20M200 7L207 7M207 7L207 20M200 13L203 13M203 13L203 20M230 7L237 7M237 7L237 20M230 13L233 13M233 13L233 20M300 7L307 7M307 7L307 20M300 13L303 13M303 13L303 20M390 7L397 7M397 7L397 20M390 13L393 13M393 13L393 20M480 7L487 7M487 7L487 20M480 13L483 13M483 13L483 20M580 7L587 7M587 7L587 20M580 13L583 13M583 13L583 20M670 7L677 7M677 7L677 20M670 13L673 13M673 13L673 20"/>
5
+ <g fill="#72beff"><rect x="0" y="20" width="20" height="20"/><rect x="50" y="20" width="20" height="20"/><rect x="80" y="20" width="20" height="20"/><rect x="130" y="20" width="20" height="20"/><rect x="210" y="20" width="20" height="20"/><rect x="240" y="20" width="20" height="20"/><rect x="290" y="20" width="20" height="20"/><rect x="320" y="20" width="20" height="20"/><rect x="430" y="20" width="20" height="20"/><rect x="510" y="20" width="20" height="20"/><rect x="570" y="20" width="20" height="20"/><rect x="600" y="20" width="20" height="20"/></g>
6
+ <path fill="none" stroke="#3f698c" stroke-width="1.6" stroke-linecap="square" d="M23 27L30 27M23 27L23 40M27 33L30 33M27 33L27 40M30 27L40 27M30 33L40 33M40 27L50 27M40 33L50 33M70 27L77 27M77 27L77 40M70 33L73 33M73 33L73 40M103 20L103 40M107 20L107 40M153 27L160 27M153 27L153 40M157 33L160 33M157 33L157 40M160 27L170 27M160 33L170 33M170 27L180 27M170 33L180 33M180 27L190 27M180 33L190 33M190 27L200 27M190 33L200 33M207 20L207 33M200 33L207 33M203 20L203 27M200 27L203 27M233 20L233 40M237 20L237 40M263 27L270 27M263 27L263 40M267 33L270 33M267 33L267 40M270 27L280 27M270 33L280 33M280 27L290 27M280 33L290 33M310 27L317 27M317 27L317 40M310 33L313 33M313 33L313 40M343 27L350 27M343 27L343 40M347 33L350 33M347 33L347 40M350 27L360 27M350 33L360 33M360 27L370 27M360 33L370 33M370 27L380 27M370 33L380 33M380 27L390 27M380 33L390 33M397 20L397 33M390 33L397 33M393 20L393 27M390 27L393 27M403 20L403 33M403 33L410 33M407 20L407 27M407 27L410 27M410 27L420 27M410 33L420 33M420 27L430 27M420 33L430 33M453 27L460 27M453 27L453 40M457 33L460 33M457 33L457 40M460 27L470 27M460 33L470 33M470 27L480 27M470 33L480 33M487 20L487 33M480 33L487 33M483 20L483 27M480 27L483 27M533 27L540 27M533 27L533 40M537 33L540 33M537 33L537 40M540 27L550 27M540 33L550 33M550 27L560 27M550 33L560 33M560 27L570 27M560 33L570 33M590 27L597 27M597 27L597 40M590 33L593 33M593 33L593 40M623 27L630 27M623 27L623 40M627 33L630 33M627 33L627 40M630 27L640 27M630 33L640 33M640 27L650 27M640 33L650 33M650 27L660 27M650 33L660 33M660 27L670 27M660 33L670 33M677 20L677 33M670 33L677 33M673 20L673 27M670 27L673 27"/>
7
+ <g fill="#56adff"><rect x="0" y="40" width="70" height="20"/><rect x="80" y="40" width="20" height="20"/><rect x="130" y="40" width="50" height="20"/><rect x="210" y="40" width="20" height="20"/><rect x="240" y="40" width="60" height="20"/><rect x="320" y="40" width="70" height="20"/><rect x="430" y="40" width="20" height="20"/><rect x="510" y="40" width="20" height="20"/><rect x="570" y="40" width="20" height="20"/><rect x="600" y="40" width="70" height="20"/></g>
8
+ <path fill="none" stroke="#2f5f8c" stroke-width="1.6" stroke-linecap="square" d="M73 40L73 60M77 40L77 60M103 40L103 60M107 40L107 60M180 47L187 47M187 47L187 60M180 53L183 53M183 53L183 60M233 40L233 60M237 40L237 60M303 47L310 47M303 47L303 60M307 53L310 53M307 53L307 60M317 40L317 53M310 53L317 53M313 40L313 47M310 47L313 47M390 47L397 47M397 47L397 60M390 53L393 53M393 53L393 60M453 40L453 60M457 40L457 60M533 40L533 60M537 40L537 60M593 40L593 60M597 40L597 60M670 47L677 47M677 47L677 60M670 53L673 53M673 53L673 60"/>
9
+ <g fill="#399bff"><rect x="0" y="60" width="20" height="20"/><rect x="50" y="60" width="20" height="20"/><rect x="80" y="60" width="20" height="20"/><rect x="130" y="60" width="20" height="20"/><rect x="210" y="60" width="20" height="20"/><rect x="240" y="60" width="20" height="20"/><rect x="290" y="60" width="20" height="20"/><rect x="370" y="60" width="20" height="20"/><rect x="430" y="60" width="20" height="20"/><rect x="510" y="60" width="20" height="20"/><rect x="570" y="60" width="20" height="20"/><rect x="650" y="60" width="20" height="20"/></g>
10
+ <path fill="none" stroke="#1f558c" stroke-width="1.6" stroke-linecap="square" d="M23 67L30 67M23 67L23 80M27 73L30 73M27 73L27 80M30 67L40 67M30 73L40 73M40 67L50 67M40 73L50 73M73 60L73 80M77 60L77 80M103 60L103 80M107 60L107 80M153 67L160 67M153 67L153 80M157 73L160 73M157 73L157 80M160 67L170 67M160 73L170 73M170 67L180 67M170 73L180 73M187 60L187 73M180 73L187 73M183 60L183 67M180 67L183 67M233 60L233 80M237 60L237 80M263 67L270 67M263 67L263 80M267 73L270 73M267 73L267 80M270 67L280 67M270 73L280 73M280 67L290 67M280 73L290 73M310 67L317 67M317 67L317 80M310 73L313 73M313 73L313 80M323 60L323 73M323 73L330 73M327 60L327 67M327 67L330 67M330 67L340 67M330 73L340 73M340 67L350 67M340 73L350 73M350 67L360 67M350 73L360 73M360 67L370 67M360 73L370 73M393 60L393 80M397 60L397 80M453 60L453 80M457 60L457 80M533 60L533 80M537 60L537 80M593 60L593 80M597 60L597 80M603 60L603 73M603 73L610 73M607 60L607 67M607 67L610 67M610 67L620 67M610 73L620 73M620 67L630 67M620 73L630 73M630 67L640 67M630 73L640 73M640 67L650 67M640 73L650 73M673 60L673 80M677 60L677 80"/>
11
+ <g fill="#1d8aff"><rect x="0" y="80" width="20" height="20"/><rect x="50" y="80" width="20" height="20"/><rect x="80" y="80" width="20" height="20"/><rect x="130" y="80" width="20" height="20"/><rect x="210" y="80" width="20" height="20"/><rect x="240" y="80" width="20" height="20"/><rect x="290" y="80" width="20" height="20"/><rect x="320" y="80" width="70" height="20"/><rect x="430" y="80" width="20" height="20"/><rect x="520" y="80" width="60" height="20"/><rect x="600" y="80" width="70" height="20"/></g>
12
+ <path fill="none" stroke="#104c8c" stroke-width="1.6" stroke-linecap="square" d="M23 80L23 100M27 80L27 100M73 80L73 100M77 80L77 100M103 80L103 100M107 80L107 100M153 80L153 100M157 80L157 100M233 80L233 100M237 80L237 100M263 80L263 100M267 80L267 100M313 80L313 100M317 80L317 100M393 80L393 100M397 80L397 100M453 80L453 100M457 80L457 100M513 80L513 93M513 93L520 93M517 80L517 87M517 87L520 87M583 87L590 87M583 87L583 100M587 93L590 93M587 93L587 100M597 80L597 93M590 93L597 93M593 80L593 87M590 87L593 87M673 80L673 100M677 80L677 100"/>
13
+ <g fill="#0078ff"></g>
14
+ <path fill="none" stroke="#00428c" stroke-width="1.6" stroke-linecap="square" d="M3 100L3 113M3 113L10 113M7 100L7 107M7 107L10 107M10 107L20 107M10 113L20 113M27 100L27 113M20 113L27 113M23 100L23 107M20 107L23 107M53 100L53 113M53 113L60 113M57 100L57 107M57 107L60 107M60 107L70 107M60 113L70 113M77 100L77 113M70 113L77 113M73 100L73 107M70 107L73 107M83 100L83 113M83 113L90 113M87 100L87 107M87 107L90 107M90 107L100 107M90 113L100 113M107 100L107 113M100 113L107 113M103 100L103 107M100 107L103 107M133 100L133 113M133 113L140 113M137 100L137 107M137 107L140 107M140 107L150 107M140 113L150 113M157 100L157 113M150 113L157 113M153 100L153 107M150 107L153 107M213 100L213 113M213 113L220 113M217 100L217 107M217 107L220 107M220 107L230 107M220 113L230 113M237 100L237 113M230 113L237 113M233 100L233 107M230 107L233 107M243 100L243 113M243 113L250 113M247 100L247 107M247 107L250 107M250 107L260 107M250 113L260 113M267 100L267 113M260 113L267 113M263 100L263 107M260 107L263 107M293 100L293 113M293 113L300 113M297 100L297 107M297 107L300 107M300 107L310 107M300 113L310 113M317 100L317 113M310 113L317 113M313 100L313 107M310 107L313 107M323 100L323 113M323 113L330 113M327 100L327 107M327 107L330 107M330 107L340 107M330 113L340 113M340 107L350 107M340 113L350 113M350 107L360 107M350 113L360 113M360 107L370 107M360 113L370 113M370 107L380 107M370 113L380 113M380 107L390 107M380 113L390 113M397 100L397 113M390 113L397 113M393 100L393 107M390 107L393 107M433 100L433 113M433 113L440 113M437 100L437 107M437 107L440 107M440 107L450 107M440 113L450 113M457 100L457 113M450 113L457 113M453 100L453 107M450 107L453 107M523 100L523 113M523 113L530 113M527 100L527 107M527 107L530 107M530 107L540 107M530 113L540 113M540 107L550 107M540 113L550 113M550 107L560 107M550 113L560 113M560 107L570 107M560 113L570 113M570 107L580 107M570 113L580 113M587 100L587 113M580 113L587 113M583 100L583 107M580 107L583 107M603 100L603 113M603 113L610 113M607 100L607 107M607 107L610 107M610 107L620 107M610 113L620 113M620 107L630 107M620 113L630 113M630 107L640 107M630 113L640 113M640 107L650 107M640 113L650 113M650 107L660 107M650 113L660 113M660 107L670 107M660 113L670 113M677 100L677 113M670 113L677 113M673 100L673 107M670 107L673 107"/>
15
+ </svg>
package/core/CLAUDE.md CHANGED
@@ -13,8 +13,12 @@ in the product repo. Nothing about the operator lives here; that belongs in `acc
13
13
 
14
14
  **The first message names the scope being worked on: a workspace.** Every brain has at least one —
15
15
  `personal`, the operator's own work, is the one every brain is born with. If the message does not
16
- name one, list the slugs under the workspaces folder and ask which. Never guess it: the context of
17
- one scope inside the work of another is the most expensive failure in the system.
16
+ name one, run the startup scan without `--workspace`. When the brain has exactly one workspace, the
17
+ scan takes it, whatever its name: start in it without asking and without announcing it, and use the
18
+ name of that only folder for the startup read and for the rest of the session. When it has none or
19
+ several, the scan stops and lists them: ask which. Never guess it: the context of one
20
+ scope inside the work of another is the most expensive failure in the system — with a single
21
+ workspace there is no other scope to mix it with.
18
22
 
19
23
  Before answering the first message, in this order:
20
24
 
@@ -176,6 +180,11 @@ in the product's root resolver.
176
180
  - **A lateral question — anything not already loaded by the startup or the focus — runs `recall` in
177
181
  the session's own scope before any `grep`.** Two `current` results that contradict each other are
178
182
  reported as ❓, never picked between in silence.
183
+ - **A file the agent has read can mention others; the agent opens one only when the task needs
184
+ something that file holds.** What the startup and the focus load is decided by their scripts, never
185
+ by this rule. Before opening a mentioned file whole, the agent runs `recall` for the part it needs and
186
+ opens the file only if the fragment is not enough. A mention written as a Markdown link and one
187
+ written as a path in backticks follow the same rule.
179
188
  - **The brain works on `main` and commits as it goes.** Every file created or edited in the brain
180
189
  during a session —a draft, a sketch, a note— is committed and pushed in the same turn it appears;
181
190
  nothing of the brain's own work waits for the close to be committed, and no draft is added to
package/core/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.2.0
@@ -10,12 +10,13 @@
10
10
  # - `<ws>/learnings/index.md` — every learning of the workspace, the same way.
11
11
  # - `<node>/index.md` — at the root of every area node (a product, a course, a channel, an account) of
12
12
  # the workspace (spec 078, C1), whether or not anything names it. Spec 079 gives it, in this order: a
13
- # title and a line that say what it is (C3); the marker `<!-- os:focus-start -->`; Initiatives in
14
- # progress (a table: initiative linked to its `README.md` · status · horizon · tasks linked to its
15
- # `backlog.md` with the open count; C1, C6, C9, C11); the marker `<!-- os:focus-end -->`; Closed
16
- # initiatives (the same table); and then Key decisions and Other decisions (two tables), Learnings and
17
- # Documents, each a table (C12). A node with nothing to list (no initiative, decision or learning about it,
18
- # no document of its own) has no index, and a generated one it had is deleted (C13).
13
+ # title and a line that say what it is (C3); the marker `<!-- os:focus-start -->`; the Initiatives
14
+ # section and its In progress subsection (a table: initiative linked to its `README.md` · status ·
15
+ # horizon · tasks linked to its `backlog.md` with the open count; C1, C6, C9, C11); the marker
16
+ # `<!-- os:focus-end -->`; its Closed subsection (the same table); and then Decisions with its Key and
17
+ # Other subsections (two tables), Learnings (a table) and Documents, one subsection per folder with its
18
+ # table (C12; spec 089 reorganizes the sections). A node with nothing to list (no initiative, decision or
19
+ # learning about it, no document of its own) has no index, and a generated one it had is deleted (C13).
19
20
  # The focus read prints only what is between the two markers (C4).
20
21
  # Spec 079 (C10) takes out what spec 078 wrote for an initiative: no `<initiative>/index.md` is written
21
22
  # any more, and every generated one found in the workspace is deleted, with its own `.gitignore` line.
@@ -363,6 +364,16 @@ seccion() {
363
364
  fi
364
365
  }
365
366
 
367
+ # subseccion TITLE BODY -> a level-3 heading and the body right under it, the same shape as `seccion`; an empty
368
+ # body says there is nothing yet.
369
+ subseccion() {
370
+ if [ -n "$2" ]; then
371
+ printf '### %s\n%s' "$1" "${2%"$nl"}"
372
+ else
373
+ printf '### %s\n%s' "$1" "$S_INDEX_EMPTY"
374
+ fi
375
+ }
376
+
366
377
  # tabla HEADER_CELLS ROWS -> the table (header row, separator, rows), or nothing when there are no rows.
367
378
  # HEADER_CELLS are the already-translated column names separated by a tab.
368
379
  tabla() {
@@ -421,16 +432,16 @@ doc_record() {
421
432
  printf '%s\t%s\t%s\t[%s](%s)\t%s\n' "$sd" "$t" "${rel//$tab/%09}" "$(md_cell "$t")" "$(md_dest "$(os_rel_link "$from" "$rel")")" "$fecha"
422
433
  }
423
434
 
424
- # docs_sorted LABEL BASE FROM -> the table rows `| LABEL | date | link |` of the files whose paths come on
435
+ # docs_sorted BASE FROM -> the table rows `| date | link |` of the files whose paths come on
425
436
  # stdin: the dated first, newest date first; the same date, by title and then by path; the undated last, by
426
437
  # title and then by path.
427
438
  docs_sorted() {
428
- local label="$1" base="$2" from="$3" rel
439
+ local base="$1" from="$2" rel
429
440
  while IFS= read -r rel || [ -n "$rel" ]; do
430
441
  [ -n "$rel" ] || continue
431
442
  doc_record "$rel" "$base" "$from"
432
443
  done | LC_ALL=C sort -t "$tab" -k1,1r -k2,2 -k3,3 | while IFS="$tab" read -r _d _t _r l f; do
433
- printf '| %s | %s | %s |\n' "$(md_cell "$label")" "$(md_cell "$f")" "$l"
444
+ printf '| %s | %s |\n' "$(md_cell "$f")" "$l"
434
445
  done
435
446
  }
436
447
 
@@ -549,10 +560,10 @@ while IFS= read -r node || [ -n "$node" ]; do
549
560
  # Initiatives: the open ones by horizon (the codes, not the labels), title and path; the closed ones by title.
550
561
  cols_ini="$S_INDEX_COL_INITIATIVE$tab$S_INDEX_COL_STATUS$tab$S_INDEX_COL_HORIZON$tab$S_INDEX_COL_TASKS"
551
562
  rows="$(printf '%s' "$inis_open" | filas_iniciativas)"
552
- sec_open="$(seccion "$S_INDEX_INITIATIVES_OPEN" "$(tabla "$cols_ini" "$rows")")"
563
+ sec_open="$(seccion "$S_INDEX_INITIATIVES" "$(subseccion "$S_INDEX_INITIATIVES_OPEN" "$(tabla "$cols_ini" "$rows")")")"
553
564
  rows="$(printf '%s' "$inis_closed" | filas_iniciativas)"
554
565
  sec_closed=""
555
- [ -z "$rows" ] || sec_closed="$nl$nl$(seccion "$S_INDEX_INITIATIVES_CLOSED" "$(tabla "$cols_ini" "$rows")")"
566
+ [ -z "$rows" ] || sec_closed="$nl$nl$(subseccion "$S_INDEX_INITIATIVES_CLOSED" "$(tabla "$cols_ini" "$rows")")"
556
567
  # Decisions and learnings about the node.
557
568
  recs_d=""; recs_l=""
558
569
  i=0
@@ -578,8 +589,9 @@ while IFS= read -r node || [ -n "$node" ]; do
578
589
  if [ -z "$rows_k$rows_o" ]; then
579
590
  decs="$(seccion "$S_INDEX_DECISIONS" "")"
580
591
  else
581
- [ -z "$rows_k" ] || decs="$(seccion "$S_INDEX_DECISIONS_KEY" "$(tabla "$cols_dec" "$rows_k")")"
582
- [ -z "$rows_o" ] || decs="$decs${decs:+$nl$nl}$(seccion "$S_INDEX_DECISIONS_OTHER" "$(tabla "$cols_dec" "$rows_o")")"
592
+ [ -z "$rows_k" ] || decs="$(subseccion "$S_INDEX_DECISIONS_KEY" "$(tabla "$cols_dec" "$rows_k")")"
593
+ [ -z "$rows_o" ] || decs="$decs${decs:+$nl$nl}$(subseccion "$S_INDEX_DECISIONS_OTHER" "$(tabla "$cols_dec" "$rows_o")")"
594
+ decs="$(seccion "$S_INDEX_DECISIONS" "$decs")"
583
595
  fi
584
596
  lrns="$(tabla "$S_INDEX_COL_DATE$tab$S_INDEX_COL_LEARNING" \
585
597
  "$(printf '%s' "$recs_l" | LC_ALL=C sort -t "$tab" -k1,1r -k2,2 -k3,3 | ultimo_campo)")"
@@ -610,12 +622,11 @@ CONTENTS
610
622
  *) list="$g_resources"; label="$S_INDEX_FOLDER_RESOURCES" ;;
611
623
  esac
612
624
  [ -n "$list" ] || continue
613
- docs="$docs$(docs_sorted "$label" "$from" "$from" <<LIST
625
+ docs="$docs${docs:+$nl$nl}$(subseccion "$label" "$(tabla "$S_INDEX_COL_DATE$tab$S_INDEX_COL_DOCUMENT" "$(docs_sorted "$from" "$from" <<LIST
614
626
  $list
615
627
  LIST
616
- )$nl"
628
+ )")")"
617
629
  done
618
- docs="$(tabla "$S_INDEX_COL_FOLDER$tab$S_INDEX_COL_DATE$tab$S_INDEX_COL_DOCUMENT" "$docs")"
619
630
  # A node with nothing to list (no initiative, decision or learning about it, no document of its own) has no index.
620
631
  if [ -z "$inis_open$inis_closed$recs_d$recs_l$docs" ]; then
621
632
  retirar_indice_de_nodo "$from/index.md"
@@ -1819,6 +1819,22 @@ SLUGS
1819
1819
  return 1
1820
1820
  }
1821
1821
 
1822
+ # os_ws_only BRAIN -> prints the slug and returns 0 when the workspaces folder of the brain has exactly one
1823
+ # workspace, whatever its name. With none or with two or more it prints nothing and returns 1. The only place
1824
+ # that decides when a session may start without being told the workspace (spec 089, part C); the rule itself
1825
+ # is written once, in `core/CLAUDE.md`.
1826
+ os_ws_only() {
1827
+ local s only="" n=0
1828
+ while IFS= read -r s || [ -n "$s" ]; do
1829
+ [ -n "$s" ] || continue
1830
+ only="$s"; n=$(( n + 1 ))
1831
+ done <<SLUGS
1832
+ $(os_org_slugs "$1")
1833
+ SLUGS
1834
+ [ "$n" = "1" ] || return 1
1835
+ printf '%s' "$only"
1836
+ }
1837
+
1822
1838
  # os_titulo ARCHIVO -> el primer `# Título` del archivo, o vacío.
1823
1839
  os_titulo() {
1824
1840
  local line
@@ -0,0 +1,234 @@
1
+ #!/usr/bin/env bash
2
+ # The AI First OS look in Obsidian (spec 089, part B). Internal: not invocable on its own — it has a
3
+ # capability row in `core/resolver.md`, and `core/skills/bootstrap.md` (at the close of the install) and
4
+ # the update of `public/README.md` drive it.
5
+ #
6
+ # Usage: obsidian-look.sh --brain DIR [--apply | --decline]
7
+ #
8
+ # The state is one word in `.system/obsidian-look`: `applied` or `declined`.
9
+ #
10
+ # (no flags), no state prints the question, the two options and "Reply with the number". Writes nothing.
11
+ # (no flags), `applied` replaces only the CSS files of the brain that carry the mark with the ones of this
12
+ # version. Prints `obsidian-look: refreshed` if something changed, nothing if not.
13
+ # (no flags), `declined` prints nothing and writes nothing.
14
+ # --apply applies the look (rules below) and writes `applied`.
15
+ # --decline writes `declined`; with `applied` it changes nothing and says so.
16
+ #
17
+ # Rules of --apply, all of them inside the brain's own folder:
18
+ # - a CSS that does not exist is copied; one that exists with the mark (the first line of the product's
19
+ # files) is replaced; one that exists WITHOUT the mark is the person's: not touched, and named in a line
20
+ # `not touched: <file>`;
21
+ # - `appearance.json` and `app.json` that do not exist are copied; ones that exist are merged: only the
22
+ # snippets that were installed are added to `enabledCssSnippets`, `accentColor` is written only if there
23
+ # was none, and `app.json` gets only the keys it lacks. No other key changes value. Merging needs
24
+ # Python; without it that file is not touched and a `not touched` line says so, and the rest applies;
25
+ # - the three files Obsidian rewrites on its own go to `.gitignore`;
26
+ # - no `.md` is touched, no plugin is installed, `community-plugins.json` is not touched.
27
+ # The CSS never needs Python, so the refresh never asks for it.
28
+ #
29
+ # Exit: 0 done (or nothing to do) · 1 invalid argument or no brain.
30
+
31
+ set -eu
32
+
33
+ here=$(cd "$(dirname "$0")" && pwd)
34
+ . "$here/common.sh"
35
+
36
+ brain=""
37
+ mode="auto"
38
+ while [ $# -gt 0 ]; do
39
+ case "$1" in
40
+ --brain) brain="$2"; shift 2 ;;
41
+ --apply) mode="apply"; shift ;;
42
+ --decline) mode="decline"; shift ;;
43
+ *) os_die "unknown argument: $1" ;;
44
+ esac
45
+ done
46
+ [ -n "$brain" ] || os_die "--brain is required"
47
+ [ -d "$brain" ] || os_die "the brain does not exist: $brain"
48
+ brain=$(cd "$brain" && pwd -P)
49
+
50
+ tpl="$here/../templates/obsidian"
51
+ mark='/* ai-first-os-look: generated, do not edit */'
52
+ state_rel="$OS_SYSTEM_DIR/obsidian-look"
53
+ state_file="$brain/$state_rel"
54
+ snippets="tables callouts tasks kanban heading-icons note-covers note-margins"
55
+ ignores="/.obsidian/workspace.json /.obsidian/workspace-mobile.json /.obsidian/graph.json"
56
+
57
+ state=""
58
+ [ ! -f "$state_file" ] || state=$(head -n 1 "$state_file" | tr -d '[:space:]')
59
+
60
+ language=$(os_language "$brain")
61
+ os_lang_load "$language"
62
+
63
+ write_state() {
64
+ mkdir -p "$brain/$OS_SYSTEM_DIR"
65
+ printf '%s\n' "$1" > "$state_file"
66
+ }
67
+
68
+ # is_marked FILE -> 0 when the first line of FILE is the mark.
69
+ is_marked() {
70
+ [ -f "$1" ] && [ "$(head -n 1 "$1")" = "$mark" ]
71
+ }
72
+
73
+ # css_source NAME -> the product's file for this snippet in the brain's language: templates/obsidian/<language>/snippets/
74
+ # when it exists (the Spanish callouts), else templates/obsidian/snippets/ (English, and every other language).
75
+ css_source() {
76
+ if [ -f "$tpl/$language/snippets/$1.css" ]; then
77
+ printf '%s' "$tpl/$language/snippets/$1.css"
78
+ else
79
+ printf '%s' "$tpl/snippets/$1.css"
80
+ fi
81
+ }
82
+
83
+ # install_file SRC DST -> copies SRC over DST through a temporary file next to it. Returns 1 when any step fails
84
+ # (and removes the temporary file), so the caller can stop instead of reporting a file that is not there.
85
+ install_file() {
86
+ local src="$1" dst="$2" tmpf="$2.tmp.$$"
87
+ mkdir -p "$(dirname "$dst")" 2>/dev/null && cp "$src" "$tmpf" 2>/dev/null && mv "$tmpf" "$dst" 2>/dev/null && return 0
88
+ rm -f "$tmpf" 2>/dev/null
89
+ printf 'error: could not write %s\n' "${dst#"$brain"/}" >&2
90
+ return 1
91
+ }
92
+
93
+ # put_css NAME -> copies or replaces one snippet and sets `css_result` to `installed` (the brain now carries the
94
+ # product's file: copied, replaced or already equal) or `not-touched` (the file there is the person's). Not run in
95
+ # a command substitution, so a failed copy reaches the caller as a non-zero return.
96
+ css_result=""
97
+ put_css() {
98
+ local src dst="$brain/.obsidian/snippets/$1.css"
99
+ src=$(css_source "$1")
100
+ if [ ! -e "$dst" ]; then
101
+ install_file "$src" "$dst" || return 1
102
+ css_result="installed"
103
+ elif is_marked "$dst"; then
104
+ if ! diff -q "$src" "$dst" > /dev/null 2>&1; then
105
+ install_file "$src" "$dst" || return 1
106
+ fi
107
+ css_result="installed"
108
+ else
109
+ css_result="not-touched"
110
+ fi
111
+ }
112
+
113
+ css_changed=0
114
+ if [ "$mode" = "decline" ]; then
115
+ if [ "$state" = "applied" ]; then
116
+ printf '%s\n' "$S_OBSIDIAN_LOOK_ALREADY_APPLIED"
117
+ exit 0
118
+ fi
119
+ write_state declined
120
+ printf 'obsidian-look: declined\n'
121
+ exit 0
122
+ fi
123
+
124
+ if [ "$mode" = "auto" ]; then
125
+ case "$state" in
126
+ declined) exit 0 ;;
127
+ applied)
128
+ for n in $snippets; do
129
+ src=$(css_source "$n")
130
+ if is_marked "$brain/.obsidian/snippets/$n.css" && ! diff -q "$src" "$brain/.obsidian/snippets/$n.css" > /dev/null 2>&1; then
131
+ install_file "$src" "$brain/.obsidian/snippets/$n.css" || exit 1
132
+ css_changed=1
133
+ fi
134
+ done
135
+ [ "$css_changed" = "0" ] || printf 'obsidian-look: refreshed\n'
136
+ exit 0
137
+ ;;
138
+ *)
139
+ printf '%s\n' "$S_OBSIDIAN_LOOK_QUESTION"
140
+ printf ' 1. %s\n' "$S_OBSIDIAN_LOOK_OPTION_APPLY"
141
+ printf ' 2. %s\n' "$S_OBSIDIAN_LOOK_OPTION_NO"
142
+ printf '%s\n' "$S_CHOICE_REPLY_WITH_NUMBER"
143
+ exit 0
144
+ ;;
145
+ esac
146
+ fi
147
+
148
+ # ---------------------------------------------------------------------------------------------- --apply
149
+ installed=""
150
+ untouched_css=0
151
+ for n in $snippets; do
152
+ put_css "$n" || { printf 'error: the look was not applied; nothing was enabled\n' >&2; exit 1; }
153
+ case "$css_result" in
154
+ installed) installed="$installed $n" ;;
155
+ *) untouched_css=1; printf 'not touched: .obsidian/snippets/%s.css\n' "$n" ;;
156
+ esac
157
+ done
158
+
159
+ obs="$brain/.obsidian"
160
+ mkdir -p "$obs"
161
+ have_py=1
162
+ os_python_find || have_py=0
163
+
164
+ # merge_json KIND -> merges the product's file into the brain's with Python. KIND is appearance or app.
165
+ merge_json() {
166
+ local kind="$1" list="$2"
167
+ os_py -I - "$tpl/$kind.json" "$obs/$kind.json" "$kind" "$list" <<'PY'
168
+ import json, os, sys, tempfile
169
+ src, dst, kind, installed = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4].split()
170
+ with open(src, encoding="utf-8") as fh:
171
+ tpl = json.load(fh)
172
+ try:
173
+ with open(dst, encoding="utf-8") as fh:
174
+ cur = json.load(fh)
175
+ except FileNotFoundError:
176
+ cur = {}
177
+ if not isinstance(cur, dict):
178
+ sys.exit(3)
179
+ new = dict(cur)
180
+ if kind == "appearance":
181
+ if "accentColor" not in new:
182
+ new["accentColor"] = tpl["accentColor"]
183
+ if "translucency" not in new and not cur:
184
+ new["translucency"] = tpl["translucency"]
185
+ snips = new.get("enabledCssSnippets")
186
+ if not isinstance(snips, list):
187
+ snips = []
188
+ for s in installed:
189
+ if s not in snips:
190
+ snips = snips + [s]
191
+ new["enabledCssSnippets"] = snips
192
+ else:
193
+ for k, v in tpl.items():
194
+ if k not in new:
195
+ new[k] = v
196
+ if new != cur:
197
+ fd, tmp = tempfile.mkstemp(prefix=os.path.basename(dst) + ".", suffix=".tmp", dir=os.path.dirname(dst))
198
+ try:
199
+ with os.fdopen(fd, "w", encoding="utf-8") as fh:
200
+ json.dump(new, fh, indent=2, ensure_ascii=False)
201
+ fh.write("\n")
202
+ os.replace(tmp, dst)
203
+ except BaseException:
204
+ try:
205
+ os.unlink(tmp)
206
+ except OSError:
207
+ pass
208
+ raise
209
+ PY
210
+ }
211
+
212
+ for kind in appearance app; do
213
+ f="$obs/$kind.json"
214
+ if [ ! -e "$f" ] && { [ "$kind" = "app" ] || [ "$untouched_css" = "0" ]; }; then
215
+ cp "$tpl/$kind.json" "$f"
216
+ elif [ "$have_py" = "1" ]; then
217
+ merge_json "$kind" "$installed" || printf 'not touched: .obsidian/%s.json\n' "$kind"
218
+ else
219
+ printf 'not touched: .obsidian/%s.json\n' "$kind"
220
+ fi
221
+ done
222
+
223
+ # The files Obsidian rewrites on its own would show up as unconfirmed changes at every start.
224
+ gi="$brain/.gitignore"
225
+ touch "$gi"
226
+ # A last line with no newline would swallow the first line we add.
227
+ if [ -s "$gi" ] && [ -n "$(tail -c 1 "$gi")" ]; then printf '\n' >> "$gi"; fi
228
+ for line in $ignores; do
229
+ grep -qxF -- "$line" "$gi" || printf '%s\n' "$line" >> "$gi"
230
+ done
231
+
232
+ write_state applied
233
+ printf 'obsidian-look: applied\n'
234
+ exit 0
@@ -121,7 +121,6 @@ fi
121
121
  [ "$root_pedido" = "0" ] || os_root_gone "$brain"
122
122
 
123
123
  [ -n "$brain" ] || os_die "missing --brain"
124
- [ -n "$org" ] || os_die "missing --org or --workspace"
125
124
  [ -d "$brain" ] || os_die "no such brain: $brain"
126
125
  brain=$(cd "$brain" && pwd)
127
126
 
@@ -135,6 +134,25 @@ head=$(os_head_file "$brain") || true
135
134
  lang=$(os_language "$brain")
136
135
  os_lang_load "$lang"
137
136
 
137
+ # No workspace named (spec 089, part C): the same resolution as the scan, through the same function.
138
+ if [ -z "$org" ]; then
139
+ if org=$(os_ws_only "$brain"); then
140
+ :
141
+ else
142
+ listed=0
143
+ printf '%s\n' "$S_SESSION_ORG_NOT_NAMED" >&2
144
+ while IFS= read -r slug || [ -n "$slug" ]; do
145
+ [ -n "$slug" ] || continue
146
+ printf ' %s\n' "$slug" >&2
147
+ listed=1
148
+ done <<SLUGS
149
+ $(os_org_slugs "$brain")
150
+ SLUGS
151
+ [ "$listed" = "1" ] || printf ' %s\n' "$S_SESSION_NO_ORGS" >&2
152
+ exit 2
153
+ fi
154
+ fi
155
+
138
156
  # ---------------------------------------------------------------- the scope is validated by listing
139
157
  # Byte for byte against the real names under the workspaces folder, never with `-d`, and with the
140
158
  # same keys the scan uses: a scope that does not exist has to read the same in both places.
@@ -86,7 +86,6 @@ fi
86
86
  [ -n "$org" ] || org="$workspace"
87
87
 
88
88
  [ -n "$brain" ] || os_die "falta --brain"
89
- [ -n "$org" ] || os_die "falta --org o --workspace"
90
89
  [ -d "$brain" ] || os_die "no existe el brain: $brain"
91
90
  brain=$(cd "$brain" && pwd)
92
91
 
@@ -112,6 +111,27 @@ memory_types_org=$(os_memory_types "$brain" org) || memory_types_org=""
112
111
  lang=$(os_language "$brain")
113
112
  os_lang_load "$lang"
114
113
 
114
+ # No workspace named (spec 089, part C): with exactly one in the brain, it is that one, as if it had been
115
+ # passed with --workspace; with none or several, the scan stops and lists them. The rule is written once, in
116
+ # `core/CLAUDE.md`, and decided in one place, `os_ws_only` (common.sh).
117
+ if [ -z "$org" ]; then
118
+ if org=$(os_ws_only "$brain"); then
119
+ :
120
+ else
121
+ listed=0
122
+ printf '%s\n' "$S_SESSION_ORG_NOT_NAMED" >&2
123
+ while IFS= read -r slug || [ -n "$slug" ]; do
124
+ [ -n "$slug" ] || continue
125
+ printf ' %s\n' "$slug" >&2
126
+ listed=1
127
+ done <<SLUGS
128
+ $(os_org_slugs "$brain")
129
+ SLUGS
130
+ [ "$listed" = "1" ] || printf ' %s\n' "$S_SESSION_NO_ORGS" >&2
131
+ exit 2
132
+ fi
133
+ fi
134
+
115
135
  # translate_fm_broken VALUE -> the same `fm_roto`/`bl_roto` value (always in Spanish: common.sh
116
136
  # returns it, and it does not know the scan's language) translated with the catalog already loaded
117
137
  # above. Does not touch `common.sh`: `sweep.sh` and `check-resolvable.sh` keep reading those values
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/pedroromeroluna/ai-first-os/main/assets/ai-first-os-logo.svg" alt="AI First OS" width="640">
3
+ </p>
4
+
1
5
  # 📘 AI First OS — cómo funciona este sistema
2
6
 
3
7
  > [!NOTE] Este archivo es el manual del sistema
@@ -100,7 +104,7 @@ arranque de sesión. Editá la fuente —la iniciativa, la decisión, el aprendi
100
104
 
101
105
  ### Cómo arranca una sesión
102
106
 
103
- 1. Nombrás el espacio de trabajo en el que vas a trabajar.
107
+ 1. Nombrás el espacio de trabajo en el que vas a trabajar. Si tu brain tiene uno solo, no hace falta: el agente arranca en ese.
104
108
  2. El agente corre el **barrido** y la **lectura de arranque** antes de contestar: primero
105
109
  `account/operator.md`, después la cabeza del espacio de trabajo y su propia tabla de herramientas,
106
110
  su glosario y su mapa de contextos si los tiene, sus decisiones clave, y las tablas de
@@ -194,7 +198,8 @@ propia sección:
194
198
 
195
199
  > [!EXAMPLE] Una sesión de punta a punta
196
200
  > 1. **Arranque.** Nombrás el espacio de trabajo —tu trabajo propio es `personal`, el que trae todo
197
- > brain al nacer— y el agente corre el **barrido** antes de contestar nada: qué espera tu decisión,
201
+ > brain al nacer, y con uno solo el agente lo toma por su cuenta— y el agente corre el **barrido**
202
+ > antes de contestar nada: qué espera tu decisión,
198
203
  > qué está en curso, qué está trabado y por quién, qué hay en cola y qué encontraron los chequeos.
199
204
  > Después elegís foco, y recién ahí se carga el cuerpo de esa iniciativa.
200
205
  > 2. **Trabajo.** Cada pedido se rutea a su herramienta por el resolver. Nada se activa solo, y
@@ -222,6 +227,11 @@ contradicción para resolver, nunca elegidos en silencio. Y es descartable: lo q
222
227
  archivo chico que se reconstruye solo desde tus propios archivos, nunca algo que vos escribís o
223
228
  respaldás.
224
229
 
230
+ **Lo que el agente abre por su cuenta.** El arranque y el foco deciden qué se carga al empezar. Después,
231
+ una nota que el agente lee puede mencionar otras: abre una solo cuando tu pedido necesita algo que está
232
+ ahí, y busca el fragmento con `recall` antes de abrir el archivo entero. Un enlace y una ruta cuestan
233
+ lo mismo: lo que gasta la ventana del agente es abrir el archivo, no cómo está escrita la mención.
234
+
225
235
  ## ⚙️ Dónde vive la maquinaria
226
236
 
227
237
  Las herramientas —skills, scripts, agentes— viven en `.os/`, `.claude/` y `.agents/`. Esas carpetas
@@ -237,9 +247,15 @@ Los skills de un pack están en `.agents/skills/<nombre>/SKILL.md`, una carpeta
237
247
  busca primero en `.agents/skills/` y cuenta una sola vez un skill que está en las dos carpetas.
238
248
  Cualquier skill que escribas vos va al lado, como carpeta común en `.claude/skills/`.
239
249
 
250
+ **La apariencia de Obsidian.** Si leés tu cerebro en Obsidian, el agente te ofrece una sola vez, al terminar
251
+ de instalar o en tu próxima actualización, dejarlo con la apariencia de AI First OS: íconos, portadas,
252
+ colores y márgenes más anchos. Cambia cómo se ve en Obsidian y nada de lo que escribiste. Si dijiste que no,
253
+ pedila más adelante: "dejá mi cerebro con la apariencia de AI First OS". Con ella puesta, cada actualización
254
+ la mantiene al día.
255
+
240
256
  > [!TIP] Para actualizar, pedile a cualquier sesión «actualizá el sistema»
241
257
  > Para actualizar, pedile a cualquier sesión: **"actualizá el sistema"**. Con esa frase alcanza, y
242
- > cubre las dos mitades de lo que está instalado — el sistema y los packs. Qué hace paso a paso
258
+ > cubre todo lo que está instalado — el sistema, los packs y la apariencia de Obsidian. Qué hace paso a paso
243
259
  > está escrito una sola vez, en el `README.md` de la carpeta del producto bajo **Update**; este
244
260
  > manual apunta ahí en vez de contarlo de nuevo, porque dos versiones del mismo procedimiento se
245
261
  > separan.
@@ -323,6 +339,11 @@ lleva cada tema, qué espera a qué) lo guarda en un archivo oculto que nunca te
323
339
  una y ve cuánto contexto usa cada una. **En la terminal** funciona reducida: reparte trabajo, pero
324
340
  no puede abrir sesiones nuevas ni ver cuánto contexto tiene cada una. Al prenderse te dice en cuál
325
341
  estás.
342
+ - **Un tema largo, en su propia sesión.** Si vas a ir y venir muchas veces sobre una sola cosa,
343
+ hacelo directo en la sesión de ese tema. La orquestadora es para pasar de un tema a otro, ver
344
+ prioridades y pendientes, aprobar el último paso que no se puede deshacer y abrir o reiniciar
345
+ sesiones. Cada pedido que pasa por ella se paga dos veces, tarda una vuelta más y pierde matices
346
+ en el camino. Cuando vuelvas, lee lo que la sesión del tema dejó escrito y se pone al día sola.
326
347
 
327
348
  ## 🚦 Trabajar con agentes: dos gates y un tramo autónomo
328
349