ai-first-os 1.9.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/LICENSE +21 -0
- package/README.md +226 -0
- package/bin/ai-first-os.js +72 -0
- package/core/CLAUDE.md +148 -0
- package/core/VERSION +1 -0
- package/core/agents/ambiguous-spec.md +39 -0
- package/core/agents/complete-spec.md +36 -0
- package/core/agents/scout.md +25 -0
- package/core/install.sh +243 -0
- package/core/lib/archive.sh +347 -0
- package/core/lib/bootstrap.sh +276 -0
- package/core/lib/capture.sh +188 -0
- package/core/lib/check-resolvable.sh +172 -0
- package/core/lib/close-session.sh +741 -0
- package/core/lib/common.sh +1773 -0
- package/core/lib/focus-read.sh +282 -0
- package/core/lib/manual-link.sh +111 -0
- package/core/lib/markdown.py +304 -0
- package/core/lib/migrate-backlogs.sh +207 -0
- package/core/lib/migrate-canonicals.sh +523 -0
- package/core/lib/mount-repo.sh +543 -0
- package/core/lib/my-wiki-gates.sh +137 -0
- package/core/lib/my-wiki.sh +202 -0
- package/core/lib/my_wiki_build.py +548 -0
- package/core/lib/my_wiki_graph.py +137 -0
- package/core/lib/my_wiki_overview.py +392 -0
- package/core/lib/new-memory.sh +160 -0
- package/core/lib/new-product.sh +122 -0
- package/core/lib/new-workspace.sh +105 -0
- package/core/lib/pack-install.sh +114 -0
- package/core/lib/recall.sh +235 -0
- package/core/lib/recall_index.py +295 -0
- package/core/lib/remote-backup.sh +84 -0
- package/core/lib/rename-heads.sh +354 -0
- package/core/lib/rename-workspaces.sh +271 -0
- package/core/lib/session-read.sh +203 -0
- package/core/lib/session-start.sh +854 -0
- package/core/lib/supersede.sh +436 -0
- package/core/lib/sweep.sh +473 -0
- package/core/manual/COMO-FUNCIONA.md +251 -0
- package/core/manual/HOW-IT-WORKS.md +250 -0
- package/core/resolver.md +30 -0
- package/core/skills/archive.md +95 -0
- package/core/skills/bootstrap.md +226 -0
- package/core/skills/capture.md +65 -0
- package/core/skills/check-resolvable.md +38 -0
- package/core/skills/close-session.md +108 -0
- package/core/skills/grill.md +74 -0
- package/core/skills/mount-repo.md +97 -0
- package/core/skills/my-wiki.md +103 -0
- package/core/skills/new-memory.md +76 -0
- package/core/skills/new-product.md +55 -0
- package/core/skills/new-spec.md +114 -0
- package/core/skills/new-workspace.md +53 -0
- package/core/skills/recall.md +64 -0
- package/core/skills/rename-heads.md +72 -0
- package/core/skills/rename-workspaces.md +43 -0
- package/core/skills/supersede.md +83 -0
- package/core/skills/sweep.md +40 -0
- package/core/templates/my-wiki-graph.js +431 -0
- package/core/templates/my-wiki-overview.js +174 -0
- package/core/templates/my-wiki.html +1017 -0
- package/core/templates/node-folder/README.md +11 -0
- package/core/templates/node-folder/resolver.md +9 -0
- package/core/templates/node-light.md +22 -0
- package/core/templates/node-product/README.md +8 -0
- package/core/templates/node-repo/README.md +14 -0
- package/core/templates/node-repo/context/README.md +22 -0
- package/core/templates/node-repo/context/competitors.md +8 -0
- package/core/templates/node-repo/context/glossary.md +8 -0
- package/core/templates/node-repo/context/open-questions.md +9 -0
- package/core/templates/node-repo/context/opportunities.md +9 -0
- package/core/templates/node-repo/context/problem.md +8 -0
- package/core/templates/node-repo/context/scope.md +8 -0
- package/core/templates/node-repo/context/users.md +8 -0
- package/core/templates/node-repo/context/vision.md +8 -0
- package/core/templates/node-repo/resolver.md +14 -0
- package/core/templates/operator.md +17 -0
- package/core/templates/person.md +10 -0
- package/core/templates/repo-scaffold/ARCHITECTURE.md +3 -0
- package/core/templates/repo-scaffold/CLAUDE.md +23 -0
- package/core/templates/repo-scaffold/decisions.md +3 -0
- package/core/templates/repo-scaffold/evals-run.sh +14 -0
- package/core/templates/repo-scaffold/gitignore +3 -0
- package/core/templates/repo-scaffold/settings.json +8 -0
- package/core/templates/root-resolver.md +5 -0
- package/core/templates/strings.md +1361 -0
- package/core/templates/tree.md +59 -0
- package/core/templates/voice.md +5 -0
- package/package.json +23 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pedro Romero Luna
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# AI First OS
|
|
2
|
+
|
|
3
|
+
Latest version and what changed in it: [Releases](https://github.com/pedroromeroluna/ai-first-os/releases) Β· [CHANGELOG.md](CHANGELOG.md).
|
|
4
|
+
|
|
5
|
+
A product operating system for working with agents. One primitive βthe nodeβ repeated at every
|
|
6
|
+
level: every session opens with a scan of your work, you capture whatever comes up on the fly, you
|
|
7
|
+
close the session with a verdict of what got done and what is missing, you mount a repo onto an
|
|
8
|
+
initiative, you get interviewed to write specs ready to delegate. The craft on top βdiscovery, the
|
|
9
|
+
metric brief, the interview that writes a product's strategic layerβ travels in packs, each one
|
|
10
|
+
published as its own set of skills: see **The AI First Product Skills pack** below.
|
|
11
|
+
|
|
12
|
+
The skills are written in English. The deliverables come out in the language you work in.
|
|
13
|
+
|
|
14
|
+
This document is written for your agent to execute, not for you to follow step by step.
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
**Installing the system takes two things: git and python3.** They are checked before anything runs
|
|
19
|
+
β an agent that installs first and reads the error afterwards leaves you with `command not found`
|
|
20
|
+
instead of an answer.
|
|
21
|
+
|
|
22
|
+
| What | When it is needed | How the agent checks it | Where it comes from if it is missing |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| git | To install the system | `git --version` | macOS: `xcode-select --install` Β· Windows: git-scm.com |
|
|
25
|
+
| python3 | To install the system β `mount-repo` uses it to authorize a checkout for the agent | `python3 --version` | macOS: `xcode-select --install` (same command as git) Β· Windows: python.org Β· Linux: your distro's package manager |
|
|
26
|
+
| Node.js | Only for the `npx` install path β the git-clone path below never needs it | `node --version` | The LTS installer at nodejs.org |
|
|
27
|
+
| Node.js | Only for the pack of skills, offered at the end of the install | `node --version` | The LTS installer at nodejs.org |
|
|
28
|
+
|
|
29
|
+
**The agent guides; you install.** System software is never installed by the agent on its own: it
|
|
30
|
+
points at the official channel, waits for you to run it, and checks again.
|
|
31
|
+
|
|
32
|
+
**git has no path around it, and neither does python3.** Every brain is versioned from the moment
|
|
33
|
+
it exists β that is what gives you an auditable history and updates you can undo β and mounting a
|
|
34
|
+
repo needs python3 to authorize it for the agent, so nothing gets written until both are there.
|
|
35
|
+
Install what is missing and say "run bootstrap" again; nothing you already answered is lost.
|
|
36
|
+
|
|
37
|
+
**Node is not a requirement of the git-clone path below, and that path never runs `npx`.** Node
|
|
38
|
+
belongs to two optional things: installing with `npx ai-first-os` instead of cloning, and the pack of
|
|
39
|
+
skills offered at the end of either path, which travels through the skills.sh CLI β`npx`, which is
|
|
40
|
+
part of Nodeβ. Without Node, use the git-clone path; the system installs completely either way, and
|
|
41
|
+
the pack stays as a task in your backlog with the exact command in it until you have Node.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
### Claude Code
|
|
46
|
+
|
|
47
|
+
**With Node.js, `npx` is the short path.** Paste this to your agent, once:
|
|
48
|
+
|
|
49
|
+
> Run `npx ai-first-os`, then read and follow the exact path it prints β that is the skill that
|
|
50
|
+
> conducts the interview.
|
|
51
|
+
|
|
52
|
+
`npx ai-first-os` checks the two requirements from the table above the same way the rest of this page describes, then leaves
|
|
53
|
+
the system at `~/.ai-first-os` β replacing whatever was there before, never merging with it β and
|
|
54
|
+
prints the path of the skill to read next. It never installs system software, never asks a question,
|
|
55
|
+
and never runs anything from what it just copied. **Do not replicate what it does by hand**: a
|
|
56
|
+
hand-copied install skips the symlinks the system needs and leaves it broken; the script is the
|
|
57
|
+
deliverable, and running it again is always the fix.
|
|
58
|
+
|
|
59
|
+
**Without Node.js, clone the repository instead.** Save this message and paste it to your agent,
|
|
60
|
+
once:
|
|
61
|
+
|
|
62
|
+
> Install AI First OS from `github.com/pedroromeroluna/ai-first-os`. Bring the repository down to a
|
|
63
|
+
> fixed local folder on this machine βyou will need it to update laterβ, run its bootstrap to build
|
|
64
|
+
> my brain with a short interview about who I am and which workspaces I work in, if any, and then
|
|
65
|
+
> run its installer to hook it into that brain. Ask me whatever the interview needs before writing
|
|
66
|
+
> anything.
|
|
67
|
+
|
|
68
|
+
You do not have to do anything else, either way. The agent brings the system down, interviews you and
|
|
69
|
+
hooks up the tools; you only answer the interview.
|
|
70
|
+
|
|
71
|
+
That is the full install: the session contract, the two resolvers, the three delegation subagents
|
|
72
|
+
and the eleven skills of the system, hooked in by symlink. Nothing is downloaded from a registry and
|
|
73
|
+
nothing asks you to confirm an install in the middle, beyond `npx`'s own one-time download prompt on
|
|
74
|
+
the first path.
|
|
75
|
+
|
|
76
|
+
**The pack comes at the end.** With the brain already built, the agent offers the AI First Product
|
|
77
|
+
Skills pack βthe craft on top. With Node present it is one question, and the download asks you to
|
|
78
|
+
confirm once. Without Node, the exact command stays as a task in your backlog, and any session runs
|
|
79
|
+
it the day you have Node. Either way the system is already yours.
|
|
80
|
+
|
|
81
|
+
The eleven of the system are not published one at a time, and that is on purpose: each of them writes
|
|
82
|
+
into a brain, so on its own βwithout the session contract, the resolver and the tree of pathsβ it
|
|
83
|
+
has nowhere to write. What you can try one at a time is a pack.
|
|
84
|
+
|
|
85
|
+
## Update
|
|
86
|
+
|
|
87
|
+
Paste this to your agent:
|
|
88
|
+
|
|
89
|
+
> Update the system.
|
|
90
|
+
|
|
91
|
+
That sentence is enough, and **this is the only place that says what it does** β the manual in your
|
|
92
|
+
brain and the bootstrap skill point here instead of telling the story again. The tools come from two
|
|
93
|
+
places, so updating them has two halves and both run:
|
|
94
|
+
|
|
95
|
+
1. **The system.** The agent goes to the local folder where the repository ended up, brings down the
|
|
96
|
+
newest version and runs `core/install.sh` from that folder.
|
|
97
|
+
2. **The pack**, if you installed it. The agent runs
|
|
98
|
+
`npx skills add pedroromeroluna/ai-first-product-skills` again, which replaces the skills in `.claude/skills/` with the
|
|
99
|
+
published version. With no pack installed there is nothing to refresh, and this half is skipped.
|
|
100
|
+
|
|
101
|
+
Your brain βyour workspaces, your decisions, your contentβ is not touched: the update only
|
|
102
|
+
refreshes the tools. And if the installer were run by mistake through the hook that is already
|
|
103
|
+
installed, it stops on its own with a message before writing anything.
|
|
104
|
+
|
|
105
|
+
## Layout
|
|
106
|
+
|
|
107
|
+
This is what the install leaves you with once the interview is answered: a folder βyour brainβ
|
|
108
|
+
versioned with git, that every session opens by scanning. Everything in it is a plain text file
|
|
109
|
+
you can read in any editor. The tools are not copied in: they are symlinks to the repository you
|
|
110
|
+
brought down, so an update refreshes every brain that points at it.
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
my-brain/
|
|
114
|
+
βββ CLAUDE.md # Symlink to the session contract: what the agent does at every start
|
|
115
|
+
βββ HOW-IT-WORKS.md # The user manual, symlinked in your language (COMO-FUNCIONA.md in Spanish)
|
|
116
|
+
βββ operator.md # Who you are and how you want to be answered β written by the interview
|
|
117
|
+
βββ voice.md # How you write, so what the agent drafts in your name sounds like you
|
|
118
|
+
βββ resolver.md # Your root resolver: capability β tool; its rows win over the product's
|
|
119
|
+
βββ tree.md # Which paths a scan walks β a level of the system is a line here
|
|
120
|
+
βββ backlog.md # Your own tasks, one line each, in priority order (born on first capture)
|
|
121
|
+
βββ inbox.md # Transit for what could not be filed yet β never a destination
|
|
122
|
+
βββ mounts.md # Which repos are mounted onto which initiatives (born on first mount-repo)
|
|
123
|
+
βββ decisions.md # Index of your decisions: one line each, linking to its own file
|
|
124
|
+
βββ decisions/<date>-<slug>.md # One decision per file: what, why, and what would invalidate it
|
|
125
|
+
βββ learnings.md # Index of your learnings: one line each, linking to its own file
|
|
126
|
+
βββ learnings/<slug>.md # One learning per file, no date in the name β it updates in place
|
|
127
|
+
βββ initiatives/<slug>/README.md # Your own initiatives, one folder each, with status/horizon/owner up top
|
|
128
|
+
βββ workspaces/ # One folder per workspace β the isolation boundary
|
|
129
|
+
β βββ <workspace>/
|
|
130
|
+
β βββ README.md # Its identity, and the `role:` it activates (cpo, cto)
|
|
131
|
+
β βββ resolver.md # Where whatever gets written in this workspace goes
|
|
132
|
+
β βββ backlog.md # Its tasks
|
|
133
|
+
β βββ decisions.md # Its decisions, indexed the same way
|
|
134
|
+
β βββ decisions/ # Its decisions' own files
|
|
135
|
+
β βββ learnings.md # Its learnings, indexed the same way
|
|
136
|
+
β βββ learnings/ # Its learnings' own files
|
|
137
|
+
β βββ initiatives/ # Its initiatives, one folder each with its `README.md` inside
|
|
138
|
+
β βββ <type>/<slug>/ # A memory node of any declared type β products/ is the one this system ships with its own tool
|
|
139
|
+
β βββ README.md # Born with `new-memory --type <type>` (`new-product` is its `products` shortcut); `context/` and `research/` are filled by whatever tool the type has, or by hand
|
|
140
|
+
βββ .os/
|
|
141
|
+
β βββ core -> β¦/ai-first-os/core # The chassis by symlink: the eleven system skills in core/skills/, the shell in core/lib/
|
|
142
|
+
β βββ packs/<pack> -> β¦ # Each installed pack, by symlink
|
|
143
|
+
βββ .claude/
|
|
144
|
+
βββ agents/ # complete-spec, ambiguous-spec, scout β one symlink each
|
|
145
|
+
βββ skills/ # The pack's skills, left here by `npx skills add`
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The interview writes `operator.md`, `voice.md`, `resolver.md`, `tree.md` and one `workspaces/<slug>/`
|
|
149
|
+
per workspace you named. The rest is born the first time it is needed: `backlog.md` on the first
|
|
150
|
+
capture, `mounts.md` on the first mounted repo, `decisions.md`/`decisions/` and
|
|
151
|
+
`learnings.md`/`learnings/` when there is something to record β one file per decision and per
|
|
152
|
+
learning, with the `.md` index left as the table of contents so a session opens only the one it
|
|
153
|
+
needs instead of the whole register.
|
|
154
|
+
|
|
155
|
+
**Where the skills live.** The eleven skills of the system are not copied into your brain: they live
|
|
156
|
+
in `.os/core/skills/`, a symlink to the `core/` of the repository you brought down, and the agent
|
|
157
|
+
reaches them through the resolver. The skills of the pack are what `npx skills add` installs: one
|
|
158
|
+
folder per skill under `.claude/skills/<name>/SKILL.md` β the place your harness reads skills from,
|
|
159
|
+
which is why they show up as `/cpo`, `/prd` and so on β plus `product-builder-resolver`, the pack's
|
|
160
|
+
index. Your own skills, if you write any, go next to them as plain folders in `.claude/skills/`.
|
|
161
|
+
|
|
162
|
+
## The catalog
|
|
163
|
+
|
|
164
|
+
Seventeen skills come with the system itself, in two families. **Workflow skills** run a process and
|
|
165
|
+
leave a deliverable: they are triggered manually, by name β the index is the resolver, never
|
|
166
|
+
automatic activation. **Knowledge skills** carry a method or a standing craft and are loaded as
|
|
167
|
+
context.
|
|
168
|
+
|
|
169
|
+
### Workflow skills
|
|
170
|
+
|
|
171
|
+
| Name | What it does |
|
|
172
|
+
|---|---|
|
|
173
|
+
| `bootstrap` | Creates the brain from scratch: identity, voice, root resolver, the tree of paths a scan walks, one folder per workspace |
|
|
174
|
+
| `new-workspace` | Adds a workspace β the isolation boundary β with its identity, its resolver and its initiatives |
|
|
175
|
+
| `new-product` | Adds a product to a workspace β memory: what it is, for whom, what is known β with its identity |
|
|
176
|
+
| `new-memory` | Creates a memory-node type the first time it is used βa folder plus its five lines in `tree.md`β and adds a node to it; `--root` for a type of the operator's own work |
|
|
177
|
+
| `sweep` | The three global scans: what is pending, what is blocked and why, how the roadmap is going |
|
|
178
|
+
| `check-resolvable` | Audits the capability-to-tool graph and reports dark tools, broken links and rows pointing nowhere |
|
|
179
|
+
| `capture` | Files what you throw in mid-conversation into the right backlog, without opening a discussion |
|
|
180
|
+
| `close-session` | Closes the session with a four-part verdict: captured, not captured, candidate resolver row, where to resume |
|
|
181
|
+
| `mount-repo` | Gives an initiative a body: the remote in the head, the checkout outside the brain (or the repo born from the scaffold, with `--new`), the row in the environment table |
|
|
182
|
+
| `grill` | The pressure interview: counter-question with a concrete example, capped attempts, escape hatches, evidence hierarchy |
|
|
183
|
+
| `new-spec` | Writes a spec an agent can implement without asking for an opinion β one runnable eval per criterion |
|
|
184
|
+
| `supersede` | Marks a file as replaced by another β`superseded_by:` in the frontmatter of the old oneβ so a session that opens it knows what to read instead, and audits the marks of the whole brain |
|
|
185
|
+
| `rename-workspaces` | Adopts the current name of the workspaces folder on a brain born before it, run only when the operator asks |
|
|
186
|
+
| `rename-heads` | Adopts the single node shape βa folder with its `README.md` insideβ on a brain born before it, run only when the operator asks |
|
|
187
|
+
| `archive` | Moves a document into the node's `archive/` so the focus lists it by name instead of loading it, rewriting every reference that pointed at it, and lists what the brain already declared replaced and still loads |
|
|
188
|
+
| `recall` | Searches every file the tree reaches for a lateral question, ranked with file, line and date, current work ahead of whatever replaced it, and one jump to a result's neighbours with `--expand` |
|
|
189
|
+
| `my-wiki` | Projects the brain as one navigable page β a workspace selector, a shelf per entity type the tree declares, the initiatives under the entity each one is about, the people, what changed and a search that runs in the page β generated by script, published as an artifact by the session |
|
|
190
|
+
|
|
191
|
+
### Knowledge skills
|
|
192
|
+
|
|
193
|
+
None of them travels with the system: a standing craft belongs to the pack that carries it. Two
|
|
194
|
+
exist today, both in the pack below: `cpo`, the standing craft of a Chief Product Officer, and
|
|
195
|
+
`cto`, the standing craft of a Chief Technology Officer, written for a builder who directs an agent
|
|
196
|
+
but cannot read a diff. `cto` never opines on models, prices or capabilities from memory: it
|
|
197
|
+
verifies the state of the art live before answering, so it stays current with the latest in AI
|
|
198
|
+
without anyone editing the file.
|
|
199
|
+
|
|
200
|
+
## The AI First Product Skills pack
|
|
201
|
+
|
|
202
|
+
The craft of building product βdiscovery from a vague problem to the strategic layer, the metric
|
|
203
|
+
brief, the pressure interview, the standing crafts of a CPO and a CTOβ is published as its own set
|
|
204
|
+
of skills, in the Agent Skills format that any harness reading that standard can install:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
npx skills add pedroromeroluna/ai-first-product-skills
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
11 skills plus the pack's own index. **The bootstrap above offers that command at its close**,
|
|
211
|
+
and leaves it in your backlog if you take it later: this section is here for the other two cases β
|
|
212
|
+
trying the pack before installing the system, and adding it to a brain that was born before the pack
|
|
213
|
+
existed.
|
|
214
|
+
|
|
215
|
+
One at a time with `--skill <name>` β for example
|
|
216
|
+
`npx skills add pedroromeroluna/ai-first-product-skills --skill product-strategy`.
|
|
217
|
+
|
|
218
|
+
**Trying one skill is the way to test the toolkit before trusting it with a system install.** They
|
|
219
|
+
work on their own, in any project, with nothing else installed: a small skill, a small blast radius,
|
|
220
|
+
a real deliverable. Installed that way the deliverable is a file in the current folder; installed
|
|
221
|
+
inside the system it lands in the node it belongs to. If what they do earns your trust, the full
|
|
222
|
+
install above is the system they came from.
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
MIT. See `LICENSE`.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// AI First OS launcher β this is what `npx ai-first-os` runs.
|
|
5
|
+
//
|
|
6
|
+
// It does three things, in this order, and nothing else:
|
|
7
|
+
// 1. checks git and python3 are on PATH β the two hard requirements of the system, the same two
|
|
8
|
+
// core/lib/bootstrap.sh checks before writing anything;
|
|
9
|
+
// 2. copies core/, README.md and LICENSE from this package to a fixed folder, ~/.ai-first-os,
|
|
10
|
+
// replacing whatever was already there β the npm cache this script runs from is reclaimed,
|
|
11
|
+
// so the system cannot keep living inside it;
|
|
12
|
+
// 3. prints the exact path of the skill that conducts the interview.
|
|
13
|
+
//
|
|
14
|
+
// It never installs system software, never asks a question, and never runs anything from the
|
|
15
|
+
// tree it just copied: the interview is a separate step, run by the agent that reads the file
|
|
16
|
+
// this prints. Running this again is always safe β it replaces the destination, it never merges
|
|
17
|
+
// into it.
|
|
18
|
+
|
|
19
|
+
const { spawnSync } = require('child_process');
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
const os = require('os');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
|
|
24
|
+
function hasCommand(cmd) {
|
|
25
|
+
const result = spawnSync(cmd, ['--version'], { stdio: 'ignore' });
|
|
26
|
+
return !result.error && result.status === 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function fail(message) {
|
|
30
|
+
process.stderr.write('error: ' + message + '\n');
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!hasCommand('git')) {
|
|
35
|
+
fail(
|
|
36
|
+
'git is missing. Install it from the official channel (macOS: `xcode-select --install`; ' +
|
|
37
|
+
"Windows: git-scm.com) and run `npx ai-first-os` again β nothing was written."
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!hasCommand('python3')) {
|
|
42
|
+
fail(
|
|
43
|
+
'python3 is missing. Install it from the official channel (macOS: `xcode-select --install`, ' +
|
|
44
|
+
"the same command that brings git; Windows: python.org; Linux: your distro's package " +
|
|
45
|
+
'manager) and run `npx ai-first-os` again β nothing was written.'
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const packageRoot = path.join(__dirname, '..');
|
|
50
|
+
const dest = path.join(os.homedir(), '.ai-first-os');
|
|
51
|
+
|
|
52
|
+
function copyReplace(name) {
|
|
53
|
+
const src = path.join(packageRoot, name);
|
|
54
|
+
const target = path.join(dest, name);
|
|
55
|
+
fs.rmSync(target, { recursive: true, force: true });
|
|
56
|
+
fs.cpSync(src, target, { recursive: true });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
60
|
+
copyReplace('core');
|
|
61
|
+
copyReplace('README.md');
|
|
62
|
+
copyReplace('LICENSE');
|
|
63
|
+
|
|
64
|
+
const bootstrapPath = path.join(dest, 'core', 'skills', 'bootstrap.md');
|
|
65
|
+
|
|
66
|
+
process.stdout.write('AI First OS is installed at ' + dest + '\n');
|
|
67
|
+
process.stdout.write(
|
|
68
|
+
'Do not replicate this script by hand: a hand-copied install skips the symlinks the system ' +
|
|
69
|
+
'needs and leaves it broken. This script is the deliverable β run `npx ai-first-os` again ' +
|
|
70
|
+
'instead of rewriting it.\n'
|
|
71
|
+
);
|
|
72
|
+
process.stdout.write('Tell your agent: read and follow ' + bootstrapPath + '\n');
|
package/core/CLAUDE.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Session contract
|
|
2
|
+
|
|
3
|
+
This file is a symlink to the product. **It is never edited from the brain**: changing it is a PR
|
|
4
|
+
in the product repo. Nothing about the operator lives here; that belongs in `operator.md`.
|
|
5
|
+
|
|
6
|
+
## When the session starts
|
|
7
|
+
|
|
8
|
+
**The first message names the scope being worked on: a workspace, or your own work (the root).**
|
|
9
|
+
If it does not name one, list the slugs under the workspaces folder alongside the root and ask
|
|
10
|
+
which. Never guess it: the context of one scope inside the work of another is the most expensive
|
|
11
|
+
failure in the system.
|
|
12
|
+
|
|
13
|
+
Before answering the first message, in this order:
|
|
14
|
+
|
|
15
|
+
1. Run the startup scan, with whichever scope applies:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
.os/core/lib/session-start.sh --brain . --workspace <slug>
|
|
19
|
+
.os/core/lib/session-start.sh --brain . --root
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If it exits non-zero, the workspace does not exist: show the slugs it listed and ask β or the
|
|
23
|
+
installation is broken (its bilingual catalog is missing), and the error message says which.
|
|
24
|
+
|
|
25
|
+
2. Run the startup read, with the same scope:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
.os/core/lib/session-read.sh --brain . --workspace <slug>
|
|
29
|
+
.os/core/lib/session-read.sh --brain . --root
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
It prints everything the session loads before answering, in the order it has to be read. That
|
|
33
|
+
order lives in the header of `session-read.sh` and nowhere else: it is not repeated here, and
|
|
34
|
+
it is not rebuilt by hand. What the read declares as not being there was not read.
|
|
35
|
+
|
|
36
|
+
If any of them is missing, say so and continue degraded. Its content is never assumed.
|
|
37
|
+
|
|
38
|
+
English is the source language of every new component of the system; Spanish exists as a
|
|
39
|
+
translation for what a person reads. The rule is written once, at the top of the product's
|
|
40
|
+
`CLAUDE.md`, and this file references it by path instead of repeating it: `.os/core/../CLAUDE.md`
|
|
41
|
+
from the brain (`.os/core` is a symlink to the product's `core/`, so `..` reaches the product's own
|
|
42
|
+
root, which is where its `CLAUDE.md` lives β the product's root is never mounted on its own).
|
|
43
|
+
|
|
44
|
+
**The scan output is the state.** It is shown exactly as it came out βfour sections, always the
|
|
45
|
+
fourβ and it is not recomputed, nor completed with inferences, nor summarized. Above it goes **one**
|
|
46
|
+
suggested next action, and then a question.
|
|
47
|
+
|
|
48
|
+
**The body of a node is loaded only once the operator picks a focus.** The scan reads frontmatter:
|
|
49
|
+
enough to choose, not enough to work. Once the operator names one, run the focus read with the head
|
|
50
|
+
of that node:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
.os/core/lib/focus-read.sh --brain . --focus <path of the head>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
It prints everything the focus loads, in the order it has to be read. That order lives in the header
|
|
57
|
+
of `focus-read.sh` and nowhere else: it is not repeated here, and it is not rebuilt by hand.
|
|
58
|
+
|
|
59
|
+
## How the agent speaks
|
|
60
|
+
|
|
61
|
+
**The agent speaks in outcomes, never in internal jargon.** "Node", "resolver", "glob",
|
|
62
|
+
"frontmatter", "canonical" and file names are the system's vocabulary: they do not appear in what
|
|
63
|
+
the operator is told unless they name them first. What gets reported is what was written, where,
|
|
64
|
+
and what changes from now on.
|
|
65
|
+
|
|
66
|
+
## Delegating the implementation of a spec
|
|
67
|
+
|
|
68
|
+
**The supervision pattern has two human gates and one autonomous stretch in the middle**: **Gate 1**
|
|
69
|
+
a person approves the spec β the matching agent implements it **on a branch** of the mounted repo,
|
|
70
|
+
never on its main branch and never with a push β **Gate 2** a person reads the branch and merges.
|
|
71
|
+
The brain session **supervises without changing folders**: it delegates to the agent over the
|
|
72
|
+
mounted repo and keeps reading the result from here.
|
|
73
|
+
|
|
74
|
+
**Every implementing agent works in its own git worktree of the mounted repo, one worktree per
|
|
75
|
+
agent, never in the shared checkout.** Two agents sharing a checkout is a collision waiting to
|
|
76
|
+
happen β the same edit window, no signal for either that the other exists.
|
|
77
|
+
|
|
78
|
+
**A branch declares itself finished in a file, never in a chat.** With a spec, that is
|
|
79
|
+
`status: implementada` in the archived spec; without one, the trailer `Listo-para-merge: si` in its
|
|
80
|
+
last commit. A clean tree and a recent commit say nothing about whether the work is done, and the
|
|
81
|
+
answer given by the session that wrote it dies with that session.
|
|
82
|
+
|
|
83
|
+
**Gate 2 runs `scripts/merge-if-green.sh <branch>` of the mounted repo, never a bare `git merge`.**
|
|
84
|
+
It refuses a branch that does not declare itself finished, merges, runs the whole eval suite over
|
|
85
|
+
the result, and rolls the merge back if anything turns red. The person decides the branch is ready;
|
|
86
|
+
the suite decides it is correct.
|
|
87
|
+
|
|
88
|
+
**Whoever merges removes the worktree and deletes the branch: cleanup is the last step of Gate 2,
|
|
89
|
+
never of the agent's own close.** The agent leaves its worktree standing because that is what the
|
|
90
|
+
person reads at the gate; once the branch is in, both the worktree and the branch are dead weight
|
|
91
|
+
that nothing prunes on its own.
|
|
92
|
+
|
|
93
|
+
**Before resuming or reinstructing an agent, the brain checks which agents are still alive.** A
|
|
94
|
+
clean tree and a "done" notification are not proof that nothing is running: a just-spawned child has
|
|
95
|
+
not written yet. List the live agents before acting on either signal.
|
|
96
|
+
|
|
97
|
+
**An agent that reports "another agent is implementing" delegated its own work β that is the bug,
|
|
98
|
+
not a status update.** The fix is to stop the child, not to launch a second implementer. Reinstructing
|
|
99
|
+
the parent with "do it yourself" while an unseen child is still writing is how two agents end up in
|
|
100
|
+
the same tree at once.
|
|
101
|
+
|
|
102
|
+
Which agent a spec belongs to is decided by its state:
|
|
103
|
+
|
|
104
|
+
| State of the spec | Agent |
|
|
105
|
+
|---|---|
|
|
106
|
+
| Every criterion has its eval, no open decision | `complete-spec` |
|
|
107
|
+
| Unknowns, open decisions, or design-first | `ambiguous-spec` |
|
|
108
|
+
|
|
109
|
+
A third agent, `scout`, does not implement: it reads sources βcode, documentation, another specβ
|
|
110
|
+
and returns a synthesis. It is used before writing the spec, never to touch a repo.
|
|
111
|
+
|
|
112
|
+
The three live in the brain's `.claude/agents/`, symlinked to `.os/core/agents/`: the harness reads
|
|
113
|
+
them on its own, without going through the resolver. The skill that writes the spec is `new-spec`,
|
|
114
|
+
in the product's root resolver.
|
|
115
|
+
|
|
116
|
+
## Rules that do not depend on the session
|
|
117
|
+
|
|
118
|
+
- **Every path is relative to the brain**, which is the session's cwd.
|
|
119
|
+
- **Tools never activate on their own.** The index is the root resolver and invocation is explicit.
|
|
120
|
+
- **No irreversible action runs by itself.** Sending, publishing, signing and merging are prepared
|
|
121
|
+
and then requested.
|
|
122
|
+
- **Whatever the AI writes is marked**: π literal with `file:line` Β· π inference Β· β gap.
|
|
123
|
+
- **Whatever is missing is recorded as open, with who closes it.** It is never invented.
|
|
124
|
+
- **A file that another one replaced declares it**, with `superseded_by: <path relative to the
|
|
125
|
+
brain>` in its frontmatter. A session that opens a file carrying that key reads the file it names
|
|
126
|
+
before using anything from the one it opened, and says which one replaced it. Git does not answer
|
|
127
|
+
this: the agent reads the working tree, never the history. The mark is written with `supersede`,
|
|
128
|
+
which also audits the marks of the whole brain.
|
|
129
|
+
- **A node declares what it is about**, with `about: <path relative to the brain>` in the
|
|
130
|
+
frontmatter of its head, naming the head of the node this one is about: a product, an account, a
|
|
131
|
+
channel β whatever a `glob:` line of the tree reaches. It names exactly one, and the focus read
|
|
132
|
+
loads that head and the `resolver.md` beside it and stops there: one jump, never a chain. A value
|
|
133
|
+
that names no head is a finding of the startup scan, never a key that gets ignored.
|
|
134
|
+
- **Archiving a document is moving it into the node's `archive/`**, with `archive`. The focus prints
|
|
135
|
+
the names of what is archived and opens none of it; the lateral search still looks inside it and
|
|
136
|
+
`supersede` still audits it. Nothing archives itself, and nothing suggests archiving by age: what
|
|
137
|
+
the operator is offered is `archive --stale`, the documents the brain already declared replaced and
|
|
138
|
+
still keeps outside `archive/`.
|
|
139
|
+
- **A lateral question β anything not already loaded by the startup or the focus β runs `recall` in
|
|
140
|
+
the session's own scope before any `grep`.** Two `current` results that contradict each other are
|
|
141
|
+
reported as β, never picked between in silence.
|
|
142
|
+
- **The brain works on `main` and commits as it goes.** Every file created or edited in the brain
|
|
143
|
+
during a session βa draft, a sketch, a noteβ is committed and pushed in the same turn it appears;
|
|
144
|
+
nothing of the brain's own work waits for the close to be committed, and no draft is added to
|
|
145
|
+
`.gitignore` to hide it. This is not development work: it goes through no review, so a branch or
|
|
146
|
+
an uncommitted file adds nothing but confusion. **It applies to the brain only.** A mounted repo
|
|
147
|
+
is code, and code follows the pattern above: a branch per spec, no push, a person merges. What
|
|
148
|
+
the close finds uncommitted is another session's work in progress and is left alone.
|
package/core/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.9.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ambiguous-spec
|
|
3
|
+
description: Works on a spec with incomplete definition β technical unknowns, open decisions, criteria without evals, or a design-first flow. It also serves for exploratory debugging and live incidents. Use it when judgment the spec does not provide is required and no eval is going to catch the mistake.
|
|
4
|
+
model: opus
|
|
5
|
+
effort: medium
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Implementer of ambiguous specs
|
|
9
|
+
|
|
10
|
+
The spec you are about to touch is not fully defined: it has unknowns, open decisions or criteria
|
|
11
|
+
without evals. Here no automatic check catches the mistake, so the judgment is yours and being
|
|
12
|
+
transparent about what you assumed is part of the deliverable.
|
|
13
|
+
|
|
14
|
+
**You implement it yourself. You never spawn another agent to do the implementation.** You keep the
|
|
15
|
+
`Agent` tool because you may need a `scout` to read a source before deciding β a subagent, if you use
|
|
16
|
+
one, only reads; it never writes to the repo, and it never implements in your place.
|
|
17
|
+
|
|
18
|
+
1. Read the repo's constitution (`CLAUDE.md`), then `ARCHITECTURE.md`, then the spec.
|
|
19
|
+
2. **Before building, list explicitly what is undefined** and split it in two: what you can settle
|
|
20
|
+
with evidence from the repo, and what requires a human decision.
|
|
21
|
+
3. If it is design-first, de-risk first with the smallest possible smoke test. Do not build on top
|
|
22
|
+
of an unknown.
|
|
23
|
+
4. Work on a branch, never on the main branch.
|
|
24
|
+
5. Every decision you make along the way goes into the repo's decisions file, with its why and the
|
|
25
|
+
alternatives you discarded. If you do not record it, it will be re-litigated.
|
|
26
|
+
6. Update `ARCHITECTURE.md` / `DESIGN.md` if they changed. Leave the branch ready for a human.
|
|
27
|
+
|
|
28
|
+
**Before writing anything after a resumed pause, and before every commit, run `git status`.** A
|
|
29
|
+
change in the tree that you did not make is a stop signal: report it, do not merge it and do not
|
|
30
|
+
overwrite it. It means another agent is already writing to this same tree.
|
|
31
|
+
|
|
32
|
+
**On a blocker, stop and present alternatives with their trade-offs, the manual one included β
|
|
33
|
+
never chain workarounds.**
|
|
34
|
+
|
|
35
|
+
If by the end the spec ended up defined enough for another agent to re-implement it without
|
|
36
|
+
judgment, say so: that means the specification work is already done and the next iteration can step
|
|
37
|
+
down to a cheaper agent.
|
|
38
|
+
|
|
39
|
+
**Never**: push to the main branch, merge, touch production, or spawn another agent to implement.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: complete-spec
|
|
3
|
+
description: Implements a spec that is already fully defined β every acceptance criterion has its runnable eval and none of them asks for an opinion. Use it when the work is verifiable by construction and no open decision is left. If reading the spec surfaces a decision that was never made, it is not for this agent: it is for ambiguous-spec.
|
|
4
|
+
model: sonnet
|
|
5
|
+
effort: medium
|
|
6
|
+
disallowedTools: Agent
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Implementer of complete specs
|
|
10
|
+
|
|
11
|
+
The spec you are about to implement declares every criterion with its runnable eval and leaves no
|
|
12
|
+
decision unclosed. Your work is mechanical and verifiable.
|
|
13
|
+
|
|
14
|
+
**You implement it yourself. You never spawn another agent to do the implementation** β not this
|
|
15
|
+
agent, not any other. This is not available to you: `disallowedTools: Agent` above removes the tool
|
|
16
|
+
mechanically, so delegating your own work is not a judgment call you can make. If a subagent shows up
|
|
17
|
+
in your work at all, it only reads (`scout`); it never writes to the repo.
|
|
18
|
+
|
|
19
|
+
1. Read the repo's constitution (`CLAUDE.md`), then `ARCHITECTURE.md`, then the spec.
|
|
20
|
+
2. Work on a branch, never on the main branch.
|
|
21
|
+
3. Implement and run the spec's evals. If one fails, iterate until it passes.
|
|
22
|
+
4. Record the evidence of each eval in the spec β claiming without evidence is not done.
|
|
23
|
+
5. Update `ARCHITECTURE.md` / `DESIGN.md` if they changed, and the repo's decisions file if you
|
|
24
|
+
made any decision.
|
|
25
|
+
6. Archive the spec in `specs/done/` and leave the branch ready for a human to merge.
|
|
26
|
+
|
|
27
|
+
**Before writing anything after a resumed pause, and before every commit, run `git status`.** A
|
|
28
|
+
change in the tree that you did not make is a stop signal: report it, do not merge it and do not
|
|
29
|
+
overwrite it. It means another agent is already writing to this same tree.
|
|
30
|
+
|
|
31
|
+
**Stop and hand control back if**: a decision the spec does not make shows up, an eval cannot be run
|
|
32
|
+
as written, or two criteria contradict each other. That means the spec was not complete and the work
|
|
33
|
+
is not yours. Do not invent the missing criterion and do not chain workarounds: present the blocker
|
|
34
|
+
with alternatives and their trade-off.
|
|
35
|
+
|
|
36
|
+
**Never**: push to the main branch, merge, or touch production, or spawn another agent to implement.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scout
|
|
3
|
+
description: Reads sources βcode, documentation, another spec, a URLβ and returns a structured synthesis with its provenance. Writes nothing: no code, no specs, no documents. Use it for research before a spec or a decision β "what does X do today", "how does this other repo solve it", "what does this documentation say" β never for a task that also has to change a file.
|
|
4
|
+
model: sonnet
|
|
5
|
+
effort: low
|
|
6
|
+
tools: Read, Grep, Glob, WebFetch, WebSearch
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Knowledge scout
|
|
10
|
+
|
|
11
|
+
Your job is to read and synthesize, never to write. You return what you found, with its source, so
|
|
12
|
+
whoever invoked you can decide.
|
|
13
|
+
|
|
14
|
+
1. Read exactly the sources you were asked for β no more, no fewer. If the request is ambiguous
|
|
15
|
+
about scope, prefer fewer sources and say so, instead of expanding the search blindly.
|
|
16
|
+
2. Every claim in your synthesis carries its provenance: `file:line` for local code or documents,
|
|
17
|
+
the URL for a web source.
|
|
18
|
+
3. Separate what the source says literally from your interpretation. If you cannot tell them apart,
|
|
19
|
+
do not claim it.
|
|
20
|
+
4. Return a structured synthesis β not the whole source pasted in, not an unstructured summary.
|
|
21
|
+
Whoever invoked you is not going to read the full source: your synthesis is all they read.
|
|
22
|
+
|
|
23
|
+
**Never**: create or edit any file, nor run any action that changes the state of a repo or of an
|
|
24
|
+
external system. If the request includes an action on top of reading, do the reading and return the
|
|
25
|
+
rest unexecuted β whoever invoked you decides whether that action happens, and who does it.
|