ai-first-os 2.0.0 → 2.1.1
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 +12 -8
- package/bin/ai-first-os.js +67 -8
- package/core/CLAUDE.md +2 -1
- package/core/VERSION +1 -1
- package/core/lib/bootstrap.sh +9 -7
- package/core/lib/build-indexes.sh +415 -59
- package/core/lib/common.sh +137 -13
- package/core/lib/focus-read.sh +59 -3
- package/core/lib/migrate-layout.sh +1 -1
- package/core/lib/migrate-root.sh +1 -1
- package/core/lib/mount-repo.sh +5 -3
- package/core/lib/recall.sh +15 -4
- package/core/lib/session-read.sh +3 -3
- package/core/lib/session-start.sh +4 -7
- package/core/manual/COMO-FUNCIONA.md +39 -18
- package/core/manual/HOW-IT-WORKS.md +39 -18
- package/core/skills/bootstrap.md +18 -13
- package/core/skills/mount-repo.md +3 -2
- package/core/skills/recall.md +6 -0
- package/core/templates/operator.md +1 -1
- package/core/templates/strings.md +185 -11
- package/core/templates/voice.md +1 -1
- package/package.json +1 -1
package/core/lib/common.sh
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Funciones compartidas por los comandos de core/. Interno: no es invocable.
|
|
3
|
-
# Bash 3.2 en adelante. Sin dependencias fuera de bash + coreutils, con una excepción:
|
|
4
|
-
# —
|
|
5
|
-
#
|
|
3
|
+
# Bash 3.2 en adelante. Sin dependencias fuera de bash + coreutils, con una excepción: Python 3 (python3)
|
|
4
|
+
# —recomendado, no obligatorio desde la spec 080— lo usan `os_settings_authorize`, `mount-repo.sh` y
|
|
5
|
+
# `recall.sh`. Se busca con `os_python_find`, por sus tres nombres.
|
|
6
6
|
|
|
7
7
|
# Tope de identidad, en líneas. Única enunciación del número en el código distribuido.
|
|
8
8
|
OS_IDENTITY_CAP=40
|
|
@@ -14,6 +14,14 @@ OS_SYSTEM_DIR=".system"
|
|
|
14
14
|
OS_TREE_FILE="$OS_SYSTEM_DIR/tree.md"
|
|
15
15
|
OS_ROOT_RESOLVER_FILE="$OS_SYSTEM_DIR/resolver.md"
|
|
16
16
|
|
|
17
|
+
# The two lines of a generated node index that the focus read cuts at (spec 078, C4; spec 079, C4): what is
|
|
18
|
+
# between them is the part of the index the AI loads, everything outside is for the person. An index
|
|
19
|
+
# written by the spec 078 has only the end line, and the focus then prints from its first line to it. HTML
|
|
20
|
+
# comments, so no reader of Markdown shows them. Only statement of the text; `build-indexes.sh` writes them
|
|
21
|
+
# and `focus-read.sh` cuts at them.
|
|
22
|
+
OS_FOCUS_START='<!-- os:focus-start -->'
|
|
23
|
+
OS_FOCUS_END='<!-- os:focus-end -->'
|
|
24
|
+
|
|
17
25
|
# The account (spec 076, C8): who the operator is and how they write. Visible, edited by the person.
|
|
18
26
|
OS_ACCOUNT_DIR="account"
|
|
19
27
|
OS_OPERATOR_FILE="$OS_ACCOUNT_DIR/operator.md"
|
|
@@ -1044,6 +1052,37 @@ os_doc_title() {
|
|
|
1044
1052
|
printf '%s' "$t"
|
|
1045
1053
|
}
|
|
1046
1054
|
|
|
1055
|
+
# md_cell TEXT -> the text safe inside a table cell or a link label: backslash, `|`, `[` and `]` escaped.
|
|
1056
|
+
md_cell() {
|
|
1057
|
+
local t="$1"
|
|
1058
|
+
t="${t//\\/\\\\}"
|
|
1059
|
+
t="${t//|/\\|}"
|
|
1060
|
+
t="${t//[/\\[}"
|
|
1061
|
+
t="${t//]/\\]}"
|
|
1062
|
+
printf '%s' "$t"
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
# md_dest PATH -> the path as a link destination: `%`, `&`, `\`, tab, space, parentheses, `|`, `<`, `>`, `#` and `?`
|
|
1066
|
+
# encoded, and `./` before a first segment with a colon. The one place that knows it (spec 078, C6): every generated index line goes through it.
|
|
1067
|
+
md_dest() {
|
|
1068
|
+
local t="$1"
|
|
1069
|
+
t="${t//%/%25}"
|
|
1070
|
+
t="${t//&/%26}"
|
|
1071
|
+
t="${t//\\/%5C}"
|
|
1072
|
+
t="${t//$'\t'/%09}"
|
|
1073
|
+
t="${t// /%20}"
|
|
1074
|
+
t="${t//(/%28}"
|
|
1075
|
+
t="${t//)/%29}"
|
|
1076
|
+
t="${t//|/%7C}"
|
|
1077
|
+
t="${t//</%3C}"
|
|
1078
|
+
t="${t//>/%3E}"
|
|
1079
|
+
t="${t//#/%23}"
|
|
1080
|
+
t="${t//\?/%3F}"
|
|
1081
|
+
# A first segment with a colon would read as a URI scheme: `./` keeps it a relative path.
|
|
1082
|
+
case "${t%%/*}" in *:*) t="./$t" ;; esac
|
|
1083
|
+
printf '%s' "$t"
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1047
1086
|
# os_doc_index_line BRAIN REL FROM_DIR -> the index line of the document at REL (relative to the
|
|
1048
1087
|
# brain), with its links relative to FROM_DIR. Exit 1 when the file is not there.
|
|
1049
1088
|
os_doc_index_line() {
|
|
@@ -1055,11 +1094,11 @@ os_doc_index_line() {
|
|
|
1055
1094
|
line="-"
|
|
1056
1095
|
[ -n "$date" ] && line="$line $date ·"
|
|
1057
1096
|
os_doc_is_key "$key" && line="$line $S_INDEX_KEY_LABEL ·"
|
|
1058
|
-
line="$line [$title]($(os_rel_link "$from" "$rel"))"
|
|
1097
|
+
line="$line [$(md_cell "$title")]($(md_dest "$(os_rel_link "$from" "$rel")"))"
|
|
1059
1098
|
[ -n "$note" ] && line="$line — $note"
|
|
1060
1099
|
if [ -n "$sup" ]; then
|
|
1061
1100
|
if [ -f "$brain/$sup" ]; then sup_title=$(os_doc_title "$brain/$sup"); else sup_title="${sup##*/}"; fi
|
|
1062
|
-
line="$line — **$S_INDEX_SUPERSEDED_LABEL**: [$sup_title]($(os_rel_link "$from" "$sup"))"
|
|
1101
|
+
line="$line — **$S_INDEX_SUPERSEDED_LABEL**: [$(md_cell "$sup_title")]($(md_dest "$(os_rel_link "$from" "$sup")"))"
|
|
1063
1102
|
fi
|
|
1064
1103
|
printf '%s' "$line"
|
|
1065
1104
|
return 0
|
|
@@ -1073,6 +1112,19 @@ os_doc_superseded() {
|
|
|
1073
1112
|
return 1
|
|
1074
1113
|
}
|
|
1075
1114
|
|
|
1115
|
+
# os_doc_superseded_path -> the normalised path of the file that replaced the document `fm_read` just read, or
|
|
1116
|
+
# nothing (the one place outside the writer that reads the key for an index).
|
|
1117
|
+
os_doc_superseded_path() {
|
|
1118
|
+
case "$fm_superseded_by" in
|
|
1119
|
+
'') ;;
|
|
1120
|
+
*) os_rel_norm "$fm_superseded_by"; return 0 ;;
|
|
1121
|
+
esac
|
|
1122
|
+
# MADR's own form, `status: superseded by <path>` (spec 070), when the key is not there.
|
|
1123
|
+
case "$fm_status" in
|
|
1124
|
+
"superseded by "*) os_rel_norm "$(os_trim "${fm_status#superseded by }")" ;;
|
|
1125
|
+
esac
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1076
1128
|
# os_docs_sorted BRAIN DIR_REL -> the `.md` files of that folder (never its generated `index.md`),
|
|
1077
1129
|
# relative to the brain, newest `date:` first; same date, by path. An undated file goes last.
|
|
1078
1130
|
os_docs_sorted() {
|
|
@@ -1449,9 +1501,21 @@ FILES
|
|
|
1449
1501
|
# title comes from the strings catalog (`TASKS_TO_SORT_TITLE`), in the language of the brain.
|
|
1450
1502
|
OS_TASKS_TO_SORT_SLUG="tasks-to-sort"
|
|
1451
1503
|
|
|
1452
|
-
#
|
|
1504
|
+
# os_strip_emoji TEXT -> TEXT without the emoji the product itself writes at the start of a title and the space
|
|
1505
|
+
# after it (spec 079, C15): `👤 ` on the operator's heading and `✍️ ` on the voice's. Nothing else is touched, so a
|
|
1506
|
+
# name that begins with any other Unicode character comes out as it came in.
|
|
1507
|
+
os_strip_emoji() {
|
|
1508
|
+
case "$1" in
|
|
1509
|
+
"👤 "*) printf '%s' "${1#"👤 "}" ;;
|
|
1510
|
+
"✍️ "*) printf '%s' "${1#"✍️ "}" ;;
|
|
1511
|
+
*) printf '%s' "$1" ;;
|
|
1512
|
+
esac
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
# os_operator_name BRAIN -> the operator's name: the first `# Title` of `account/operator.md`, without the
|
|
1516
|
+
# emoji that opens it.
|
|
1453
1517
|
os_operator_name() {
|
|
1454
|
-
os_titulo "$1/$OS_OPERATOR_FILE"
|
|
1518
|
+
os_strip_emoji "$(os_titulo "$1/$OS_OPERATOR_FILE")"
|
|
1455
1519
|
}
|
|
1456
1520
|
|
|
1457
1521
|
# os_ini_render TITLE STATUS ABOUT OWNER DATE -> the text of the head of a new initiative, on stdout:
|
|
@@ -2157,9 +2221,61 @@ os_gitignore_ensure() {
|
|
|
2157
2221
|
return 0
|
|
2158
2222
|
}
|
|
2159
2223
|
|
|
2160
|
-
#
|
|
2161
|
-
#
|
|
2162
|
-
#
|
|
2224
|
+
# Python 3 por sus tres nombres (spec 080). Única enunciación del orden y de la prueba en bash;
|
|
2225
|
+
# `findPython` de ai-first-os.js (el lanzador de npx) la espeja. Orden: `python3`, `python`, `py -3` (el lanzador de Windows,
|
|
2226
|
+
# que deja `py` y `python` pero nunca `python3`). Un candidato se acepta solo si corre de verdad y
|
|
2227
|
+
# termina con éxito únicamente cuando su versión mayor es 3: así quedan afuera el atajo de la
|
|
2228
|
+
# Microsoft Store (falla) y un Python 2.
|
|
2229
|
+
# El comando queda en el arreglo `OS_PY` —una palabra o dos (`py -3`)—, y se corre siempre como
|
|
2230
|
+
# "${OS_PY[@]}" o con `os_py`, sin depender de que una cadena se parta en espacios.
|
|
2231
|
+
OS_PY=()
|
|
2232
|
+
OS_PYTHON_PROBE='import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)'
|
|
2233
|
+
|
|
2234
|
+
# os_python_probe CMD... -> 0 si CMD (una o dos palabras) corre y es Python 3. Con `perl` en el PATH la
|
|
2235
|
+
# prueba tiene un plazo (OS_PYTHON_PROBE_TIMEOUT, 10 s por defecto): un candidato colgado cuenta como
|
|
2236
|
+
# fallo y se pasa al siguiente. Sin `perl` no hay plazo.
|
|
2237
|
+
os_python_probe() {
|
|
2238
|
+
if command -v perl > /dev/null 2>&1; then
|
|
2239
|
+
perl -e 'alarm shift; exec @ARGV' "${OS_PYTHON_PROBE_TIMEOUT:-10}" "$@" -c "$OS_PYTHON_PROBE" > /dev/null 2>&1
|
|
2240
|
+
else
|
|
2241
|
+
"$@" -c "$OS_PYTHON_PROBE" > /dev/null 2>&1
|
|
2242
|
+
fi
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
# os_python_find -> 0 y deja el comando en OS_PY; 1 y deja OS_PY vacío si ningún nombre sirve.
|
|
2246
|
+
os_python_find() {
|
|
2247
|
+
OS_PY=()
|
|
2248
|
+
if command -v python3 > /dev/null 2>&1 && os_python_probe python3; then
|
|
2249
|
+
OS_PY=(python3); return 0
|
|
2250
|
+
fi
|
|
2251
|
+
if command -v python > /dev/null 2>&1 && os_python_probe python; then
|
|
2252
|
+
OS_PY=(python); return 0
|
|
2253
|
+
fi
|
|
2254
|
+
if command -v py > /dev/null 2>&1 && os_python_probe py -3; then
|
|
2255
|
+
OS_PY=(py -3); return 0
|
|
2256
|
+
fi
|
|
2257
|
+
return 1
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
# os_python_cmd -> imprime el comando de Python 3 (`python3`, `python` o `py -3`); sin Python 3 no
|
|
2261
|
+
# imprime nada y sale 1. Para mostrarlo y para los evals; para correrlo, `os_py`.
|
|
2262
|
+
os_python_cmd() {
|
|
2263
|
+
( os_python_find && printf '%s' "${OS_PY[*]}" )
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
# os_py ARGS... -> corre Python 3 con ARGS (stdin y stdout pasan tal cual). Sale 127 sin escribir
|
|
2267
|
+
# nada si no hay Python 3. Busca una vez por proceso. Fuerza UTF-8 en la entrada y la salida: el Python
|
|
2268
|
+
# nativo de Windows usa la página de códigos ANSI en los pipes, que corrompe nombres de archivo con
|
|
2269
|
+
# tildes y rompe con `→` o emoji.
|
|
2270
|
+
os_py() {
|
|
2271
|
+
if [ "${#OS_PY[@]}" -eq 0 ]; then
|
|
2272
|
+
os_python_find || return 127
|
|
2273
|
+
fi
|
|
2274
|
+
PYTHONIOENCODING=utf-8 PYTHONUTF8=1 "${OS_PY[@]}" "$@"
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
# El nombre del archivo de permisos del harness, relativo al brain (spec 030). Python 3 lo lee y
|
|
2278
|
+
# escribe (`os_py`); `mount-repo.sh` lo busca antes de escribir y frena sin él (spec 080).
|
|
2163
2279
|
OS_SETTINGS_ARCHIVO=".claude/settings.local.json"
|
|
2164
2280
|
|
|
2165
2281
|
# os_settings_authorize BRAIN RUTA
|
|
@@ -2171,11 +2287,12 @@ OS_SETTINGS_ARCHIVO=".claude/settings.local.json"
|
|
|
2171
2287
|
# 0 la agregó (el archivo pudo nacer o ya existir)
|
|
2172
2288
|
# 1 ya estaba
|
|
2173
2289
|
# 2 el archivo existe y no es JSON válido — no se tocó
|
|
2290
|
+
# 9 Python falló por otra razón (una excepción, no haber Python): nada se puede dar por autorizado
|
|
2174
2291
|
os_settings_authorize() {
|
|
2175
2292
|
local brain="$1" ruta="$2" archivo
|
|
2176
2293
|
archivo="$brain/$OS_SETTINGS_ARCHIVO"
|
|
2177
2294
|
mkdir -p "$(dirname "$archivo")" 2>/dev/null
|
|
2178
|
-
|
|
2295
|
+
os_py - "$archivo" "$ruta" <<'PY'
|
|
2179
2296
|
import json
|
|
2180
2297
|
import os
|
|
2181
2298
|
import sys
|
|
@@ -2200,7 +2317,7 @@ directorios = permisos.setdefault("additionalDirectories", [])
|
|
|
2200
2317
|
if not isinstance(directorios, list):
|
|
2201
2318
|
sys.exit(2)
|
|
2202
2319
|
if ruta in directorios:
|
|
2203
|
-
sys.exit(
|
|
2320
|
+
sys.exit(10)
|
|
2204
2321
|
directorios.append(ruta)
|
|
2205
2322
|
|
|
2206
2323
|
with open(archivo, "w", encoding="utf-8") as f:
|
|
@@ -2208,7 +2325,14 @@ with open(archivo, "w", encoding="utf-8") as f:
|
|
|
2208
2325
|
f.write("\n")
|
|
2209
2326
|
sys.exit(0)
|
|
2210
2327
|
PY
|
|
2211
|
-
|
|
2328
|
+
local rc=$?
|
|
2329
|
+
# Dentro de Python, 10 es «ya estaba»: un `exit 1` es el de una excepción sin atrapar, y no puede
|
|
2330
|
+
# leerse como «ya autorizado».
|
|
2331
|
+
case "$rc" in
|
|
2332
|
+
0|2) return "$rc" ;;
|
|
2333
|
+
10) return 1 ;;
|
|
2334
|
+
*) return 9 ;;
|
|
2335
|
+
esac
|
|
2212
2336
|
}
|
|
2213
2337
|
|
|
2214
2338
|
# os_now_ms -> milisegundos desde epoch.
|
package/core/lib/focus-read.sh
CHANGED
|
@@ -16,7 +16,13 @@
|
|
|
16
16
|
# 1. the head named by `--focus`
|
|
17
17
|
# 2. its body: the files a `content:` line reaches **directly inside** that node's folder,
|
|
18
18
|
# `LC_ALL=C sort` by path — for an area node (a product, a course, a channel, an account) that is
|
|
19
|
-
# its generated `index.md` (spec 076, C20)
|
|
19
|
+
# its generated `index.md` (spec 076, C20), **printed only between the lines `<!-- os:focus-start -->`
|
|
20
|
+
# and `<!-- os:focus-end -->`** (neither included): the table of the initiatives in progress and
|
|
21
|
+
# nothing else, not the title, the warning or what comes below (spec 079, C4). An index written by
|
|
22
|
+
# spec 078 has only the end line and prints from its first line up to it; an index without the end
|
|
23
|
+
# line prints whole, and so does one written by a person. A generated index whose table has no
|
|
24
|
+
# initiative row prints nothing. An initiative has no generated index (spec 079, C10); a generated
|
|
25
|
+
# `index.md` in its folder is not printed at all
|
|
20
26
|
# 3. when the focus is an area node: its own `.resolver.md`, when a `glob:` line reaches it (spec
|
|
21
27
|
# 076, C15), and its key decisions (see 6)
|
|
22
28
|
# 4. only if that head declares `about:` — for each path it names, in the order of the list (spec
|
|
@@ -148,10 +154,57 @@ separar() {
|
|
|
148
154
|
if [ "$primera" = "1" ]; then primera=0; else printf '\n'; fi
|
|
149
155
|
}
|
|
150
156
|
|
|
151
|
-
#
|
|
157
|
+
# indice_generado ARCHIVO -> 0 when the file is a generated `index.md`. Reads its frontmatter.
|
|
158
|
+
indice_generado() {
|
|
159
|
+
[ "${1##*/}" = "index.md" ] || return 1
|
|
160
|
+
[ -f "$1" ] || return 1
|
|
161
|
+
fm_read "$1"
|
|
162
|
+
[ "$fm_generated" = "true" ]
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
# region_del_foco ARCHIVO -> the lines of a generated node index that the AI reads: those between `OS_FOCUS_START`
|
|
166
|
+
# and `OS_FOCUS_END`, or from the first line when the index has no start line (spec 078).
|
|
167
|
+
region_del_foco() {
|
|
168
|
+
local line buf="" dentro=0
|
|
169
|
+
grep -qxF -- "$OS_FOCUS_START" "$1" || dentro=1
|
|
170
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
171
|
+
if [ "$line" = "$OS_FOCUS_END" ]; then break; fi
|
|
172
|
+
if [ "$dentro" = "1" ]; then
|
|
173
|
+
buf="$buf$line$nl"
|
|
174
|
+
elif [ "$line" = "$OS_FOCUS_START" ]; then
|
|
175
|
+
dentro=1
|
|
176
|
+
fi
|
|
177
|
+
done < "$1"
|
|
178
|
+
printf '%s' "$buf"
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
# indice_oculto RUTA -> 0 when the AI reads nothing from that file (spec 078, C4, C5; spec 079, C4, C9, C10): the
|
|
182
|
+
# generated index of an initiative left by spec 078, and the generated index of a node whose region holds no
|
|
183
|
+
# row of an initiative in progress. The one place that decides it; `cuerpo` is the one place that prints, so no
|
|
184
|
+
# route (the head, a jump, the body of the node) can print what this hides, or what the markers cut.
|
|
185
|
+
indice_oculto() {
|
|
186
|
+
local f="$brain/$1" region
|
|
187
|
+
indice_generado "$f" || return 1
|
|
188
|
+
case "$1" in */initiatives/*/index.md) return 0 ;; esac
|
|
189
|
+
grep -qxF -- "$OS_FOCUS_END" "$f" || return 1
|
|
190
|
+
region=$(region_del_foco "$f")
|
|
191
|
+
case "$nl$region" in *"$nl| ["*) return 1 ;; esac
|
|
192
|
+
return 0
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
# cuerpo ARCHIVO — the bytes of the file, plus the closing newline it may not have. A generated index with
|
|
196
|
+
# the end marker prints only its region; one that `indice_oculto` hides prints nothing.
|
|
152
197
|
cuerpo() {
|
|
153
|
-
local last
|
|
198
|
+
local last rel="${1#"$brain"/}" buf
|
|
154
199
|
[ -s "$1" ] || return 0
|
|
200
|
+
if indice_generado "$1"; then
|
|
201
|
+
indice_oculto "$rel" && return 0
|
|
202
|
+
if grep -qxF -- "$OS_FOCUS_END" "$1"; then
|
|
203
|
+
buf=$(region_del_foco "$1")
|
|
204
|
+
[ -z "$buf" ] || printf '%s\n' "$buf"
|
|
205
|
+
return 0
|
|
206
|
+
fi
|
|
207
|
+
fi
|
|
155
208
|
cat "$1"
|
|
156
209
|
last=$(tail -c 1 "$1")
|
|
157
210
|
if [ -n "$last" ]; then printf '\n'; fi
|
|
@@ -161,6 +214,7 @@ cuerpo() {
|
|
|
161
214
|
# emitir RUTA — one entry: its header and its body, or its `missing:` line.
|
|
162
215
|
impresos="$nl"
|
|
163
216
|
emitir() {
|
|
217
|
+
if [ -f "$brain/$1" ] && indice_oculto "$1"; then impresos="$impresos$1$nl"; return 0; fi
|
|
164
218
|
separar
|
|
165
219
|
impresos="$impresos$1$nl"
|
|
166
220
|
if [ -f "$brain/$1" ]; then
|
|
@@ -174,6 +228,7 @@ emitir() {
|
|
|
174
228
|
}
|
|
175
229
|
|
|
176
230
|
wsdir=$(os_ws_dir "$brain")
|
|
231
|
+
tipo_foco=""
|
|
177
232
|
|
|
178
233
|
# claves HEAD — step 6: the key decisions about one area node, read from the frontmatter of each
|
|
179
234
|
# decision of its workspace. Nothing for a head that is not an area node.
|
|
@@ -231,6 +286,7 @@ $contents
|
|
|
231
286
|
CONTENIDOS
|
|
232
287
|
# `sort -u`: two `content:` lines that reach the same file —two sessions declaring it at once
|
|
233
288
|
# (spec 072)— must not print its body twice.
|
|
289
|
+
# What a generated index prints is decided in `cuerpo` and `indice_oculto`, for every route.
|
|
234
290
|
while IFS= read -r f || [ -n "$f" ]; do
|
|
235
291
|
[ -n "$f" ] || continue
|
|
236
292
|
emitir "$f"
|
|
@@ -65,7 +65,7 @@ for f in "$brain/$OS_OPERATOR_FILE" "$brain/operator.md"; do
|
|
|
65
65
|
[ -f "$f" ] || continue
|
|
66
66
|
fm_read "$f"
|
|
67
67
|
if [ -n "$fm_language" ] && os_language_valido "$fm_language"; then lang="$fm_language"; fi
|
|
68
|
-
owner=$(os_titulo "$f")
|
|
68
|
+
owner=$(os_strip_emoji "$(os_titulo "$f")")
|
|
69
69
|
break
|
|
70
70
|
done
|
|
71
71
|
|
package/core/lib/migrate-root.sh
CHANGED
|
@@ -211,7 +211,7 @@ done
|
|
|
211
211
|
# ---------------------------------------------------------------- the destination workspace
|
|
212
212
|
if [ -n "$items" ] && [ ! -e "$brain/$dest" ]; then
|
|
213
213
|
printf 'created\t%s\n' "$dest" >> "$state"
|
|
214
|
-
owner=$(os_titulo "$brain/$OS_OPERATOR_FILE")
|
|
214
|
+
owner=$(os_strip_emoji "$(os_titulo "$brain/$OS_OPERATOR_FILE")")
|
|
215
215
|
[ -n "$owner" ] || owner="$S_PERSONAL_WORKSPACE_NAME"
|
|
216
216
|
"$here/new-workspace.sh" --brain "$brain" --name "$S_PERSONAL_WORKSPACE_NAME" --role "" \
|
|
217
217
|
--title "" --owner "$owner" --slug "$slug" > /dev/null \
|
package/core/lib/mount-repo.sh
CHANGED
|
@@ -32,9 +32,10 @@
|
|
|
32
32
|
#
|
|
33
33
|
# Exit: 0 montó o ya estaba · 2 argumentos o cabeza inválidos · 3 el remote no responde
|
|
34
34
|
# 4 la cabeza ya declara otro `repo:` · 5 la raíz de clonado falta o es inválida
|
|
35
|
-
# 6 falta `python3`
|
|
35
|
+
# 6 falta Python 3 —buscado como `python3`, `python` o `py -3`, spec 080—, necesario para autorizar el checkout (spec 030)
|
|
36
36
|
# 7 `--new` on a remote that does answer: there is nothing to create (spec 034)
|
|
37
37
|
# 8 `--new`: the birth of the repo failed — the message names why (spec 034)
|
|
38
|
+
# 9 Python 3 was found but the authorization of the checkout failed (spec 080): not an «already authorized»
|
|
38
39
|
#
|
|
39
40
|
# Nada se escribe antes de que las seis validaciones pasen —siete con `--new`, que suma la del
|
|
40
41
|
# destino—: una negativa a mitad de camino deja el nodo montado a medias, que es peor que no
|
|
@@ -106,7 +107,7 @@ remote_github_slug() {
|
|
|
106
107
|
printf '%s/%s' "$owner" "$name"
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
#
|
|
110
|
+
# Python 3 es necesario acá (spec 030, buscado por sus tres nombres desde la spec 080): el cuarto acto —autorizar el
|
|
110
111
|
# checkout para el harness— lo necesita para leer y escribir el JSON de settings.local.json. Se
|
|
111
112
|
# chequea antes de la primera escritura, con el mismo criterio que el resto de las validaciones.
|
|
112
113
|
# The language of what gets written is the brain's, declared once in `operator.md` (spec 021), and
|
|
@@ -115,7 +116,7 @@ remote_github_slug() {
|
|
|
115
116
|
language=$(os_language "$brain")
|
|
116
117
|
os_lang_load "$language"
|
|
117
118
|
|
|
118
|
-
|
|
119
|
+
os_python_find || {
|
|
119
120
|
printf '%s\n' "$S_MOUNT_NO_PYTHON3" >&2
|
|
120
121
|
printf '%s\n' "$S_MOUNT_NOTHING_WRITTEN" >&2
|
|
121
122
|
exit 6
|
|
@@ -498,6 +499,7 @@ case "$?" in
|
|
|
498
499
|
0) printf "$S_MOUNT_SETTINGS_ADDED\n" "$OS_SETTINGS_ARCHIVO" "$destino" ;;
|
|
499
500
|
1) printf "$S_MOUNT_SETTINGS_ALREADY\n" "$OS_SETTINGS_ARCHIVO" ;;
|
|
500
501
|
2) printf "$S_MOUNT_SETTINGS_INVALID\n" "$OS_SETTINGS_ARCHIVO" "$brain/$OS_SETTINGS_ARCHIVO" ;;
|
|
502
|
+
*) printf '%s\n' "$S_MOUNT_SETTINGS_FAILED" >&2; exit 9 ;;
|
|
501
503
|
esac
|
|
502
504
|
|
|
503
505
|
# La tabla no viaja: la frontera es el gitignore del brain, y la escribe el comando que crea el
|
package/core/lib/recall.sh
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
# WHAT THIS COMMAND INDEXES. The index is `.os/living-memory.sqlite`, inside the brain: never
|
|
12
12
|
# committed (`.os/` is already in every brain's `.gitignore`, `os_gitignore_ensure`), and it is
|
|
13
13
|
# derived and discardable — deleting it just costs the next call a full reindex. It is written with
|
|
14
|
-
# `python3
|
|
15
|
-
#
|
|
14
|
+
# Python 3 (found by `os_python_find`: python3, python or py -3) and the `sqlite3` module of the
|
|
15
|
+
# standard library, using an FTS5 table: no dependency the product does not already carry (Python 3
|
|
16
|
+
# is recommended since spec 080, and the sqlite3
|
|
16
17
|
# that ships with the official installers of macOS, Windows and Linux carries FTS5).
|
|
17
18
|
#
|
|
18
19
|
# THE FILE LIST HAS ONE READER. `tree.md` has two classes of line since spec 007, and the only
|
|
@@ -54,7 +55,8 @@
|
|
|
54
55
|
#
|
|
55
56
|
# Exit: 0 the search or the expansion ran, with or without results/neighbours. 1 invalid arguments
|
|
56
57
|
# (missing/contradictory flags, no scope named). 2 the named workspace does not exist (same keys as
|
|
57
|
-
# `session-start.sh`).
|
|
58
|
+
# `session-start.sh`). 3 Python 3 is not available under any of its names (spec 080); 1 stays for a
|
|
59
|
+
# Python that is there and an index that failed.
|
|
58
60
|
#
|
|
59
61
|
# No `set -e`: a query with no results is not a failure.
|
|
60
62
|
|
|
@@ -215,9 +217,18 @@ stdin_data="$true_heads
|
|
|
215
217
|
%%FILES%%
|
|
216
218
|
$all_files"
|
|
217
219
|
|
|
218
|
-
|
|
220
|
+
# Python 3 se busca por sus tres nombres (spec 080). Sin él, un mensaje del catálogo y el código 3:
|
|
221
|
+
# distinto del 1, que sigue siendo "hay Python 3 y el índice falló".
|
|
222
|
+
os_python_find || {
|
|
223
|
+
printf '%s\n' "$S_RECALL_NO_PYTHON" >&2
|
|
224
|
+
exit 3
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
result=$(printf '%s\n' "$stdin_data" | os_py -B "$here/recall_index.py" \
|
|
219
228
|
"$db" "$brain" "$mode" "$scope_kind" "$wsdir" "$scope_slug" "$arg" "$limit")
|
|
220
229
|
rc=$?
|
|
230
|
+
# El Python de Windows termina las líneas con CRLF: sin sacar el \r, `grep -qx` no reconoce el centinela.
|
|
231
|
+
result=${result//$'\r'/}
|
|
221
232
|
if [ "$rc" != "0" ]; then
|
|
222
233
|
printf 'error: recall.sh could not run its index (python3/sqlite3)\n' >&2
|
|
223
234
|
exit 1
|
package/core/lib/session-read.sh
CHANGED
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
# relative to that folder (`os_doc_index_line`, the shape every generated index uses). A scope with
|
|
49
49
|
# no key decision prints no marker and no lines.
|
|
50
50
|
# - Right after them, the indexes of the scope are generated (`build-indexes.sh`, spec 076 C18):
|
|
51
|
-
# `decisions/index.md`, `learnings/index.md` and the `index.md` of each area node
|
|
52
|
-
#
|
|
53
|
-
# entry, a `gitignore-declared: <path>` line per path written for the first time, which the
|
|
51
|
+
# `decisions/index.md`, `learnings/index.md` and the `index.md` of each area node that has
|
|
52
|
+
# something to list (spec 079, C13). Nothing of them is printed — the focus of a node prints its index — except, as one
|
|
53
|
+
# entry, a `gitignore-declared: <path>` line per path written for the first time or dropped because its index was retired, which the
|
|
54
54
|
# session contract tells the session to commit (`.gitignore`) in the same turn, and a
|
|
55
55
|
# `gitignore-declare-failed: <path>` line per index that could not be ignored and so was not written.
|
|
56
56
|
# - A file that is not there prints `── missing: <path>` and no body, and never stops the read.
|
|
@@ -303,7 +303,7 @@ if [ -f "$brain/$OS_OPERATOR_FILE" ]; then
|
|
|
303
303
|
marcar_leido
|
|
304
304
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
305
305
|
case "$line" in
|
|
306
|
-
'# '*) operador=$(os_trim "${line#\# }"); break ;;
|
|
306
|
+
'# '*) operador=$(os_strip_emoji "$(os_trim "${line#\# }")"); break ;;
|
|
307
307
|
esac
|
|
308
308
|
done < "$brain/$OS_OPERATOR_FILE"
|
|
309
309
|
fi
|
|
@@ -688,16 +688,13 @@ $tree_files
|
|
|
688
688
|
RESOLVERS
|
|
689
689
|
|
|
690
690
|
# ---------------------------------------------------------------- an index written by hand (spec 076, C18)
|
|
691
|
-
# The startup read generates `decisions/index.md`, `learnings/index.md
|
|
692
|
-
#
|
|
693
|
-
# skips it. The scan names it — it reads that file's frontmatter and nothing else, and never writes.
|
|
691
|
+
# The startup read generates `decisions/index.md`, `learnings/index.md`, the `index.md` of each area
|
|
692
|
+
# node that has something to list (spec 079 no longer writes one per initiative, and deletes the generated ones); one that is there without `generated: true`
|
|
693
|
+
# was written by a person, and the generator skips it. The scan names it — it reads that file's frontmatter and nothing else, and never writes.
|
|
694
694
|
for idx in "$brain/$wsdir/$org/decisions/index.md" "$brain/$wsdir/$org/learnings/index.md" \
|
|
695
695
|
"$brain/$wsdir/$org"/*/*/index.md; do
|
|
696
696
|
[ -f "$idx" ] || continue
|
|
697
697
|
idx_rel="${idx#"$brain"/}"
|
|
698
|
-
case "$idx_rel" in
|
|
699
|
-
"$wsdir/$org/initiatives/"*) continue ;;
|
|
700
|
-
esac
|
|
701
698
|
fm_read "$idx"
|
|
702
699
|
[ "$fm_generated" = "true" ] && continue
|
|
703
700
|
push_chequeo "$(printf "$S_SESSION_CHECK_INDEX_BY_HAND" "$idx_rel")"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# AI First OS — cómo funciona este sistema
|
|
1
|
+
# 📘 AI First OS — cómo funciona este sistema
|
|
2
2
|
|
|
3
3
|
> [!NOTE] Este archivo es el manual del sistema
|
|
4
4
|
> Es parte del producto y está enlazado desde él, así que se mantiene solo: cuando el sistema se
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
> archivo lo pisa la próxima actualización. Tus cosas viven en los otros archivos, y este manual dice
|
|
7
7
|
> cuáles son.
|
|
8
8
|
|
|
9
|
-
## La idea en una línea
|
|
9
|
+
## 💡 La idea en una línea
|
|
10
10
|
|
|
11
11
|
**Tu agente lee tu contexto de archivos, trabaja con vos en la sesión y lo que importa queda
|
|
12
12
|
escrito** — nunca adentro de la memoria de un chat.
|
|
@@ -14,7 +14,7 @@ escrito** — nunca adentro de la memoria de un chat.
|
|
|
14
14
|
Los archivos son tuyos: texto plano, en tu carpeta, legibles sin este sistema instalado. Lo que el
|
|
15
15
|
sistema agrega es dónde va cada cosa y quién la vuelve a leer.
|
|
16
16
|
|
|
17
|
-
## Dos nombres, dos cosas
|
|
17
|
+
## 🏷️ Dos nombres, dos cosas
|
|
18
18
|
|
|
19
19
|
- **AI First OS** es el software: los skills, el contrato de sesión, los agentes. Se instala y se
|
|
20
20
|
actualiza, y no guarda nada tuyo.
|
|
@@ -24,7 +24,7 @@ sistema agrega es dónde va cada cosa y quién la vuelve a leer.
|
|
|
24
24
|
La analogía es un sistema operativo y tu disco: el OS se actualiza; tu brain no se toca. Por eso
|
|
25
25
|
no se "instala un brain" — se instala el OS, y tu brain nace una sola vez, con la entrevista.
|
|
26
26
|
|
|
27
|
-
## Qué ves en esta carpeta
|
|
27
|
+
## 🗂️ Qué ves en esta carpeta
|
|
28
28
|
|
|
29
29
|
**En la raíz de esta carpeta se ven cuatro cosas. Todo lo demás está oculto, porque solo lo lee el
|
|
30
30
|
sistema.** La raíz tiene la maquinaria del sistema y tu cuenta — nunca trabajo. Tu trabajo propio es
|
|
@@ -84,11 +84,19 @@ permiso de escritura, para que el editor te frene antes de empezar.
|
|
|
84
84
|
### Archivos generados
|
|
85
85
|
|
|
86
86
|
Un **archivo generado** es uno que el sistema escribe por vos y reescribe solo. Su frontmatter dice
|
|
87
|
-
`generated: true`, y la cabecera de abajo dice de qué archivos sale.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
`generated: true`, y la cabecera de abajo dice de qué archivos sale. Todos empiezan con un título y
|
|
88
|
+
una línea debajo que dicen qué es y qué vas a encontrar adentro, por ejemplo «Índice de <nombre>». El
|
|
89
|
+
`index.md` de un producto, un curso, un canal o una cuenta es uno: después de ese título tiene una
|
|
90
|
+
tabla con sus iniciativas en curso, con su estado, su horizonte y una columna **Tareas**, las
|
|
91
|
+
iniciativas cerradas en una segunda tabla, y después tablas con las decisiones (las clave primero),
|
|
92
|
+
los aprendizajes y los documentos de sus carpetas `context/`, `research/` y `resources/`. El nombre
|
|
93
|
+
de cada iniciativa enlaza a su `README.md`, donde ves de qué trata, y la columna Tareas enlaza a su
|
|
94
|
+
`backlog.md` y dice cuántas tareas tiene abiertas. Para tildar una tarea, abrí el `index.md` del
|
|
95
|
+
producto, hacé clic en el número de la columna Tareas y tildá la tarea en `backlog.md`: ese archivo
|
|
96
|
+
sí lo editás vos, el índice no. Una iniciativa no tiene un índice propio: sus documentos están al
|
|
97
|
+
lado de su `README.md`. **No edites los archivos generados**: tu edición desaparece en el próximo
|
|
98
|
+
arranque de sesión. Editá la fuente —la iniciativa, la decisión, el aprendizaje o el documento— y el
|
|
99
|
+
índice la sigue. Un archivo generado no se sube a git: cada copia del brain arma el suyo.
|
|
92
100
|
|
|
93
101
|
### Cómo arranca una sesión
|
|
94
102
|
|
|
@@ -182,7 +190,7 @@ propia sección:
|
|
|
182
190
|
- **Equipo del espacio de trabajo** — una sección `## Team` en la cabeza del espacio de trabajo, para
|
|
183
191
|
quien es parte de él de forma permanente, sin atarse a ninguna iniciativa.
|
|
184
192
|
|
|
185
|
-
## El ciclo de una sesión
|
|
193
|
+
## 🔄 El ciclo de una sesión
|
|
186
194
|
|
|
187
195
|
> [!EXAMPLE] Una sesión de punta a punta
|
|
188
196
|
> 1. **Arranque.** Nombrás el espacio de trabajo —tu trabajo propio es `personal`, el que trae todo
|
|
@@ -197,7 +205,7 @@ propia sección:
|
|
|
197
205
|
> partes: qué se archivó, qué no, qué fila podría ganar el resolver y por dónde retomar. Nunca un
|
|
198
206
|
> "listo" a secas: un cierre que solo dice que terminó no se distingue de uno que perdió algo.
|
|
199
207
|
|
|
200
|
-
## Living Memory: encontrar lo que el foco no carga
|
|
208
|
+
## 🧠 Living Memory: encontrar lo que el foco no carga
|
|
201
209
|
|
|
202
210
|
El barrido y el foco solo cargan una lista fija de archivos, más un salto por `about:`. Una decisión
|
|
203
211
|
escrita meses atrás en otro espacio de trabajo es real, pero nada la saca a la luz sola — hasta que
|
|
@@ -214,7 +222,7 @@ contradicción para resolver, nunca elegidos en silencio. Y es descartable: lo q
|
|
|
214
222
|
archivo chico que se reconstruye solo desde tus propios archivos, nunca algo que vos escribís o
|
|
215
223
|
respaldás.
|
|
216
224
|
|
|
217
|
-
## Dónde vive la maquinaria
|
|
225
|
+
## ⚙️ Dónde vive la maquinaria
|
|
218
226
|
|
|
219
227
|
Las herramientas —skills, scripts, agentes— viven en `.os/`, `.claude/` y `.agents/`. Esas carpetas
|
|
220
228
|
están ocultas en Obsidian y se ven desde la terminal, y lo que el sistema pone adentro es un
|
|
@@ -236,7 +244,20 @@ Cualquier skill que escribas vos va al lado, como carpeta común en `.claude/ski
|
|
|
236
244
|
> manual apunta ahí en vez de contarlo de nuevo, porque dos versiones del mismo procedimiento se
|
|
237
245
|
> separan.
|
|
238
246
|
|
|
239
|
-
##
|
|
247
|
+
## 🧰 Requisitos
|
|
248
|
+
|
|
249
|
+
**`git` es obligatorio; Python 3 es recomendado.** El sistema se instala sin Python y lo avisa cuando
|
|
250
|
+
pasa. Sin Python 3 hay dos cosas que no funcionan:
|
|
251
|
+
|
|
252
|
+
- **Conectar un repositorio de código** (`mount-repo`).
|
|
253
|
+
- **La búsqueda de Living Memory** (`recall`). La IA busca en los archivos como texto común: no puede
|
|
254
|
+
poner la versión vigente de un documento por encima de una reemplazada, abrir la sección exacta ni
|
|
255
|
+
seguir de qué trata un documento o qué lo reemplazó.
|
|
256
|
+
|
|
257
|
+
Para tenerlas, instalá Python desde python.org: el sistema lo encuentra como `python3`, `python` o
|
|
258
|
+
`py -3`. No hace falta reinstalar nada.
|
|
259
|
+
|
|
260
|
+
## 💬 Qué podés pedir, y cómo
|
|
240
261
|
|
|
241
262
|
**El índice es el resolver, no tu memoria.** Pedís con tus palabras —"qué hay pendiente", "cerrá la
|
|
242
263
|
sesión", "capturá esto"— y el agente busca qué herramienta cubre esa capacidad. Dos archivos
|
|
@@ -286,7 +307,7 @@ sesión: **"instalá el pack `<nombre>`"**.
|
|
|
286
307
|
acordaba. Pedí lo que querés con tus palabras: la sesión lee el índice de lo que esté instalado y te
|
|
287
308
|
rutea, o te dice que nada de lo instalado lo cubre.
|
|
288
309
|
|
|
289
|
-
## Una orquestadora, si querés una
|
|
310
|
+
## 🎛️ Una orquestadora, si querés una
|
|
290
311
|
|
|
291
312
|
**Es opcional y está apagada hasta que la pidas.** Una orquestadora es una sesión donde decidís qué
|
|
292
313
|
importa y desde donde se reparte el trabajo a las demás sesiones, una por tema. Para que exista no
|
|
@@ -303,7 +324,7 @@ lleva cada tema, qué espera a qué) lo guarda en un archivo oculto que nunca te
|
|
|
303
324
|
no puede abrir sesiones nuevas ni ver cuánto contexto tiene cada una. Al prenderse te dice en cuál
|
|
304
325
|
estás.
|
|
305
326
|
|
|
306
|
-
## Trabajar con agentes: dos gates y un tramo autónomo
|
|
327
|
+
## 🚦 Trabajar con agentes: dos gates y un tramo autónomo
|
|
307
328
|
|
|
308
329
|
El trabajo pesado se delega a agentes que corren en segundo plano, mientras la sesión principal se
|
|
309
330
|
queda al timón — nunca se muda de carpeta ni pierde tu contexto.
|
|
@@ -319,7 +340,7 @@ queda al timón — nunca se muda de carpeta ni pierde tu contexto.
|
|
|
319
340
|
> principal y nunca con un push → una persona lee la rama y la mergea (**gate 2**). Autonomía en
|
|
320
341
|
> el medio, control humano en los bordes.
|
|
321
342
|
|
|
322
|
-
## Capacidades dormidas: la capa de construcción
|
|
343
|
+
## 🛠️ Capacidades dormidas: la capa de construcción
|
|
323
344
|
|
|
324
345
|
Este sistema no es solo para decidir: **también construye producto, y esa mitad queda dormida hasta
|
|
325
346
|
que la pidas.** No es un modo que se prende para todo el brain, ni algo que se instale de nuevo: se
|
|
@@ -340,7 +361,7 @@ Cuando eso pasa, se despiertan dos capacidades:
|
|
|
340
361
|
No hace falta que prepares nada hoy. Pedilo —"esta iniciativa se va a construir"— y las dos ya están
|
|
341
362
|
instaladas.
|
|
342
363
|
|
|
343
|
-
## Lo que el sistema nunca hace solo
|
|
364
|
+
## 🛑 Lo que el sistema nunca hace solo
|
|
344
365
|
|
|
345
366
|
- **Nada se activa por su cuenta.** La herramienta se elige por el resolver y se invoca explícito.
|
|
346
367
|
- **Ninguna acción irreversible corre sola.** Mandar, publicar, firmar y mergear se preparan y
|
|
@@ -349,7 +370,7 @@ instaladas.
|
|
|
349
370
|
inferencia · ❓ hueco. Lo que falta queda registrado como abierto, con quién lo cierra. Nunca se
|
|
350
371
|
inventa.
|
|
351
372
|
|
|
352
|
-
## Cómo leer los recuadros
|
|
373
|
+
## 🧭 Cómo leer los recuadros
|
|
353
374
|
|
|
354
375
|
Los archivos del sistema usan pocos recuadros, cada uno con un solo significado:
|
|
355
376
|
|