owfadev 0.0.1 → 0.3.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.
Files changed (101) hide show
  1. package/.agents/skills/asset-read/SKILL.md +39 -0
  2. package/.agents/skills/check/SKILL.md +130 -0
  3. package/.agents/skills/docs/SKILL.md +24 -0
  4. package/.agents/skills/map/SKILL.md +72 -0
  5. package/.agents/skills/plugin/SKILL.md +74 -0
  6. package/.agents/skills/profile/SKILL.md +75 -0
  7. package/.agents/skills/query/SKILL.md +48 -0
  8. package/.agents/skills/save/SKILL.md +94 -0
  9. package/.agents/skills/wiki_plugin_kernel/SKILL.md +104 -0
  10. package/.meta/VERSION +1 -0
  11. package/.meta/command/asset-read/SKILL.md +39 -0
  12. package/.meta/command/check/SKILL.md +130 -0
  13. package/.meta/command/docs/SKILL.md +24 -0
  14. package/.meta/command/map/SKILL.md +72 -0
  15. package/.meta/command/plugin/SKILL.md +74 -0
  16. package/.meta/command/profile/SKILL.md +75 -0
  17. package/.meta/command/query/SKILL.md +48 -0
  18. package/.meta/command/save/SKILL.md +94 -0
  19. package/.meta/command/wiki_plugin_kernel/SKILL.md +104 -0
  20. package/.meta/docs/agent-behavior.md +68 -0
  21. package/.meta/docs/agents-example.md +34 -0
  22. package/.meta/docs/conversion.md +24 -0
  23. package/.meta/docs/deployment.md +311 -0
  24. package/.meta/docs/developer.md +33 -0
  25. package/.meta/docs/distribution.md +132 -0
  26. package/.meta/docs/intro.md +56 -0
  27. package/.meta/docs/log-example.md +19 -0
  28. package/.meta/docs/map.md +23 -0
  29. package/.meta/docs/mechanics.md +180 -0
  30. package/.meta/docs/naming.md +113 -0
  31. package/.meta/docs/packages.md +140 -0
  32. package/.meta/docs/quickstart.md +79 -0
  33. package/.meta/docs/research-landscape.md +132 -0
  34. package/.meta/docs/research-user-profile.md +27 -0
  35. package/.meta/docs/sandbox.md +40 -0
  36. package/.meta/docs/usage.md +45 -0
  37. package/.meta/plugins/core/calendar/PLUGIN.md +35 -0
  38. package/.meta/plugins/core/calendar/PLUGIN.yaml +21 -0
  39. package/.meta/plugins/core/cron/PLUGIN.md +38 -0
  40. package/.meta/plugins/core/cron/PLUGIN.yaml +24 -0
  41. package/.meta/plugins/core/device/PLUGIN.md +38 -0
  42. package/.meta/plugins/core/device/PLUGIN.yaml +21 -0
  43. package/.meta/plugins/core/device/scripts/check.py +29 -0
  44. package/.meta/plugins/core/domain/PLUGIN.md +43 -0
  45. package/.meta/plugins/core/domain/PLUGIN.yaml +8 -0
  46. package/.meta/plugins/core/hot/PLUGIN.md +40 -0
  47. package/.meta/plugins/core/hot/PLUGIN.yaml +15 -0
  48. package/.meta/plugins/core/index/PLUGIN.md +39 -0
  49. package/.meta/plugins/core/index/PLUGIN.yaml +18 -0
  50. package/.meta/plugins/core/instance-git/PLUGIN.md +39 -0
  51. package/.meta/plugins/core/instance-git/PLUGIN.yaml +15 -0
  52. package/.meta/plugins/core/instance-git/scripts/check.py +90 -0
  53. package/.meta/plugins/core/language/PLUGIN.md +38 -0
  54. package/.meta/plugins/core/language/PLUGIN.yaml +23 -0
  55. package/.meta/plugins/core/language/scripts/check.py +23 -0
  56. package/.meta/plugins/core/link/PLUGIN.md +39 -0
  57. package/.meta/plugins/core/link/PLUGIN.yaml +16 -0
  58. package/.meta/plugins/core/link/scripts/check.py +122 -0
  59. package/.meta/plugins/core/log/PLUGIN.md +58 -0
  60. package/.meta/plugins/core/log/PLUGIN.yaml +18 -0
  61. package/.meta/plugins/core/log/scripts/check.py +21 -0
  62. package/.meta/plugins/core/mapping/PLUGIN.md +32 -0
  63. package/.meta/plugins/core/mapping/PLUGIN.yaml +24 -0
  64. package/.meta/plugins/core/mapping/scripts/check.py +90 -0
  65. package/.meta/plugins/core/notes/PLUGIN.md +42 -0
  66. package/.meta/plugins/core/notes/PLUGIN.yaml +19 -0
  67. package/.meta/plugins/core/sessions/PLUGIN.md +63 -0
  68. package/.meta/plugins/core/sessions/PLUGIN.yaml +20 -0
  69. package/.meta/plugins/core/sessions/scripts/check.py +33 -0
  70. package/.meta/plugins/core/structure/PLUGIN.md +29 -0
  71. package/.meta/plugins/core/structure/PLUGIN.yaml +18 -0
  72. package/.meta/plugins/core/structure/scripts/check.py +32 -0
  73. package/.meta/plugins/core/tag/PLUGIN.md +37 -0
  74. package/.meta/plugins/core/tag/PLUGIN.yaml +18 -0
  75. package/.meta/plugins/core/tag/scripts/check.py +28 -0
  76. package/.meta/plugins/core/tmp/PLUGIN.md +26 -0
  77. package/.meta/plugins/core/tmp/PLUGIN.yaml +16 -0
  78. package/.meta/plugins/core/todo/PLUGIN.md +33 -0
  79. package/.meta/plugins/core/todo/PLUGIN.yaml +22 -0
  80. package/.meta/plugins/core/trust/PLUGIN.md +70 -0
  81. package/.meta/plugins/core/trust/PLUGIN.yaml +23 -0
  82. package/.meta/plugins/core/trust/scripts/check.py +77 -0
  83. package/.meta/plugins/core/user-profile/PLUGIN.md +39 -0
  84. package/.meta/plugins/core/user-profile/PLUGIN.yaml +30 -0
  85. package/.meta/plugins/core/vault/PLUGIN.md +28 -0
  86. package/.meta/plugins/core/vault/PLUGIN.yaml +13 -0
  87. package/.meta/plugins/core/wiki/PLUGIN.md +37 -0
  88. package/.meta/plugins/core/wiki/PLUGIN.yaml +8 -0
  89. package/.meta/protocol/actions.md +42 -0
  90. package/.meta/protocol/experiments.md +40 -0
  91. package/.meta/protocol/registry.yaml +75 -0
  92. package/.meta/scripts/pipeline.py +428 -0
  93. package/.meta/scripts/wiki_plugin_kernel.py +1891 -0
  94. package/.meta/scripts/wikilib.py +79 -0
  95. package/.meta/tests/test_install_preflight.py +177 -0
  96. package/LICENSE +21 -21
  97. package/README.md +96 -15
  98. package/README.zh-CN.md +103 -0
  99. package/bin/owfa.js +594 -0
  100. package/package.json +36 -7
  101. package/templates/AGENTS.template.md +19 -0
@@ -0,0 +1,311 @@
1
+ # Deployment
2
+
3
+ > Reader: anyone installing OWFA into a directory (an Obsidian vault, a notes folder, any workspace), or the agent doing it for you. This is the full guide — components, channels, first run, packages, upgrades, troubleshooting. The five-minute path is [quickstart.md](quickstart.md); the channel's design and release record is [distribution.md](distribution.md).
4
+
5
+ ## 1. What gets installed
6
+
7
+ OWFA has three layers, and only one of them is "installed":
8
+
9
+ | Layer | What it is | Where it lives | Installed? |
10
+ |---|---|---|---|
11
+ | **OWFA CLI** | the installer / upgrader (`init`, `upgrade`, `doctor`, `add`, `list`, `pkg`) | npm package, run via `npx` or a global install | no — it stays outside the workspace |
12
+ | **OWFA Core** | the framework body: plugins, commands, protocols, kernel, skill copies | `.meta/` + `.agents/skills/` | yes — copied into the workspace |
13
+ | **kernel** | the deterministic Python engine (`validate`, `inject`, `registry`, `deploy`, `install`) | `.meta/scripts/wiki_plugin_kernel.py` | no — it ships **inside** Core; there is no separate kernel install |
14
+ | **packages** | optional domain extensions (course, lark, email, bili, project…) | `.meta/plugins/domains/<pkg>/` | on demand |
15
+ | **instance** | the workspace you own: `vault/`, `wiki/`, `AGENTS.md`, the framework body | your directory | — |
16
+
17
+ The call chain is one direction:
18
+
19
+ ```
20
+ OWFA CLI → copies OWFA Core → runs the kernel → kernel converges Core + packages
21
+ ```
22
+
23
+ A deployed workspace looks like this:
24
+
25
+ ```
26
+ my-workspace/
27
+ ├── AGENTS.md # identity/layout (yours) + injection region (kernel-managed)
28
+ ├── vault/ # real assets, any format
29
+ ├── wiki/ # the markdown world
30
+ │ ├── notes/ sessions/ vault/
31
+ │ └── index.md tags.md hot.md log.md # derived, rebuilt by the pipeline
32
+ ├── .meta/ # OWFA Core
33
+ │ ├── VERSION # framework anchor (0.3)
34
+ │ ├── scripts/ # kernel + pipeline + wikilib
35
+ │ ├── plugins/core/ # 21 framework plugins
36
+ │ ├── plugins/domains/ # installed packages (empty until you add one)
37
+ │ ├── command/ # command masters
38
+ │ └── docs/ # this guide and friends
39
+ └── .agents/skills/ # deployed command/connector skill copies
40
+ ```
41
+
42
+ The kernel is **not** a service, a daemon, or a pip package. It is a pure-stdlib Python script that the CLI (and the agent) invoke on demand. Python 3.9+ is the only runtime requirement for Core.
43
+
44
+ ## 2. Prerequisites
45
+
46
+ | Item | Requirement | Needed for |
47
+ |---|---|---|
48
+ | Python | **3.9+**, pure standard library | Core and the kernel |
49
+ | Node | **16.7+** | the npm channel only (the CLI is Node) |
50
+ | agent | a coding assistant that reads `AGENTS.md` and `.agents/skills/` (e.g. ZCode, Claude Code, Cursor, dsh) | daily use |
51
+ | git | recommended | instance snapshots and upgrade rollback |
52
+ | Obsidian | optional | viewing the wiki; never required |
53
+
54
+ The framework itself has zero package-manager dependencies: no `pip install`, no Python venv, no npm dependencies in the tarball. `npm` is a delivery vehicle, not a runtime.
55
+
56
+ ## 3. Choose a channel
57
+
58
+ All channels deploy the same Core tree; pick by environment, not by feature.
59
+
60
+ | Channel | Command | Status |
61
+ |---|---|---|
62
+ | npm, target name | `npx owfa init my-workspace` | **name application pending** (npm froze `owfa` as too similar to `ow`/`ora`) |
63
+ | npm, fallback name | `npx owfadev init my-workspace` | same CLI, bins `owfa` + `owfadev`; to be published if the name is not granted |
64
+ | git, clone-as-instance | `git clone https://github.com/owfadev/owfa.git my-workspace` | works today |
65
+ | git, embed into an existing vault | clone the template elsewhere, copy `.meta/` + `.agents/skills/` | works today |
66
+ | template + instance (developers) | a template clone + a separate instance | see [CONTRIBUTING.md](../../CONTRIBUTING.md) |
67
+
68
+ > Until the npm name is served by the registry, the git channel is the working path. Do not treat `npx owfa` as live before `npm view owfa version` returns a version.
69
+ >
70
+ > The org rename executed 2026-10-26 (`AIE3905-Wuwa` → `owfadev`, `vault-wiki` → `owfa`); old repository URLs redirect, old org/API paths 404.
71
+
72
+ ## 4. Install
73
+
74
+ ### 4.1 npm channel — one command
75
+
76
+ ```bash
77
+ npx owfa init my-workspace # target; once the name is granted
78
+ # or, while the name is pending:
79
+ npx owfadev init my-workspace # fallback package, same CLI
80
+ cd my-workspace
81
+ npx owfa doctor # target: python, framework, markers, kernel validate
82
+ npx owfadev doctor # fallback: same check through the fallback package
83
+ ```
84
+
85
+ **Command forms.** `npx <package> <verb>` needs no global install. A global install (`npm i -g owfa` or `npm i -g owfadev`) puts **both** `owfa` and `owfadev` on `PATH`. The rest of this guide writes `owfa <verb>` for the CLI and `kernel …` for the Python engine; substitute `npx owfa` / `npx owfadev` if you are not installing globally.
86
+
87
+ `init` performs the five manual steps below:
88
+
89
+ 1. copies `.meta/` and `.agents/skills/` from the tarball;
90
+ 2. creates `vault/`, `wiki/notes/`, `wiki/sessions/`, `wiki/vault/`;
91
+ 3. writes `AGENTS.md` from the seed, or appends **only the injection region** to an existing one (the handwritten part is preserved; half-present markers are refused);
92
+ 4. runs `python .meta/scripts/wiki_plugin_kernel.py all` (validate → inject → registry → deploy);
93
+ 5. optionally installs packages (`--packages cuhksz,lark`), stopping at the first package that stages a semantic migration.
94
+
95
+ Useful flags:
96
+
97
+ - `--name NAME` — the workspace name written into the AGENTS seed;
98
+ - `--packages a,b` — install packages from the registry during init;
99
+ - `--force` — re-copy the framework trees over an existing instance, preserving the kernel's migration ledger, journal and registry cache. Instance data (`vault/`, `wiki/`) is never touched.
100
+
101
+ If the directory already contains `.meta/`, `init` refuses; use `owfa upgrade` (or `--force` deliberately).
102
+
103
+ ### 4.2 git channel — the five manual steps
104
+
105
+ **Clone-as-instance** (the clone *is* your workspace):
106
+
107
+ ```bash
108
+ git clone https://github.com/owfadev/owfa.git my-workspace
109
+ cd my-workspace
110
+ # own the history if you do not want the framework's:
111
+ rm -rf .git && git init
112
+ ```
113
+
114
+ **Embed into an existing vault**: clone the template somewhere else, then copy the two trees into the target root:
115
+
116
+ ```bash
117
+ cp -R /path/to/owfa/.meta /path/to/my-workspace/
118
+ cp -R /path/to/owfa/.agents/skills /path/to/my-workspace/.agents/
119
+ ```
120
+
121
+ Then, at the workspace root:
122
+
123
+ 1. **Write `AGENTS.md`** — one identity paragraph, one layout paragraph, and the injection markers verbatim from [agents-example.md](agents-example.md). If an `AGENTS.md` already exists, paste in only the marker block (or let `owfa init` append it).
124
+ 2. **Create the four directories**: `vault/`, `wiki/notes/`, `wiki/sessions/`, `wiki/vault/`. Derived pages build themselves.
125
+ 3. **Converge**:
126
+
127
+ ```bash
128
+ python .meta/scripts/wiki_plugin_kernel.py all
129
+ ```
130
+
131
+ Expected: all core plugins validate, package rosters reconcile, the injection region is rebuilt, command copies are in sync.
132
+
133
+ ### 4.3 "Installing the kernel"
134
+
135
+ There is nothing separate to install. The kernel is the file `.meta/scripts/wiki_plugin_kernel.py` inside Core; Python 3.9+ runs it. Verify it:
136
+
137
+ ```bash
138
+ python3 .meta/scripts/wiki_plugin_kernel.py validate # structural check, read-only
139
+ python3 .meta/scripts/wiki_plugin_kernel.py ls # 21 core plugins
140
+ python3 .meta/scripts/wiki_plugin_kernel.py pkg # installed packages + core remainder
141
+ ```
142
+
143
+ On Windows, `python` may be `py -3`; the CLI probes `python3`, `python`, then `py -3`. Set `OWFA_PYTHON=/path/to/python3` to override. If the kernel is missing, the Core copy is incomplete — recopy the tree, do not "pip install" anything.
144
+
145
+ ## 5. First run
146
+
147
+ ```bash
148
+ cd my-workspace
149
+ git init && git add -A && git commit -m "init: OWFA workspace" # recommended
150
+ ```
151
+
152
+ 1. Put any file into `vault/` — `memo.txt`, a PDF, an image.
153
+ 2. Open an agent session at the workspace root and say **map**.
154
+ 3. The agent writes `wiki/vault/memo.txt.md` (SHA-256 + metadata), then the pipeline builds `wiki/index.md`, directory indexes, `tags.md`, `hot.md`, `log.md`.
155
+ 4. Say **check** — a green audit means the deployment is sound.
156
+
157
+ The injection region in `AGENTS.md` now contains one block per full-tier plugin; the agent reads it as the structural contract. Everything outside the markers is yours.
158
+
159
+ ## 6. How to use it
160
+
161
+ Open the agent at the workspace root; it reads `AGENTS.md` and `.agents/skills/`. Daily commands are natural language:
162
+
163
+ | You say | What happens |
164
+ |---|---|
165
+ | map | register a vault asset as a wiki proxy page (hash, metadata, links) |
166
+ | save | distill the current conversation into a native note |
167
+ | query | answer from hot cache → index → grep, with wikilink citations |
168
+ | check | repository health audit (structure + semantic checks) |
169
+ | plugin | install / uninstall / list structural plugins |
170
+ | profile | maintain the user cognition profile |
171
+ | teach / quiz / cognition profile | course-learning family (needs a course domain, e.g. cuhksz) |
172
+ | kernel reference | kernel usage and mechanics |
173
+
174
+ The daily loops — library keeping, course learning, collaborative development — are in [usage.md](usage.md). Mechanics are in [mechanics.md](mechanics.md); the kernel reference skill is authoritative for flags.
175
+
176
+ ## 7. Packages — finding and installing
177
+
178
+ Core ships only the framework plugins. External systems arrive as **packages**: one directory `.meta/plugins/domains/<pkg>/` with a `PKG.yaml` roster, plugin masters, commands and connectors.
179
+
180
+ ### 7.1 Find what exists
181
+
182
+ Run these inside the instance:
183
+
184
+ ```bash
185
+ owfa list # registry catalog: versions, compat floors, installed marks
186
+ owfa pkg # what is installed here: members, connectors, core remainder
187
+ # the same through the kernel:
188
+ python3 .meta/scripts/wiki_plugin_kernel.py list-remote
189
+ python3 .meta/scripts/wiki_plugin_kernel.py pkg
190
+ ```
191
+
192
+ The registry is the GitHub index at `owfadev/registry`; before installing, it is also readable directly as `INDEX.yaml` in that repository. Each row shows the package version, the framework compat floor, the member plugins and the trust level.
193
+
194
+ ### 7.2 Install a package
195
+
196
+ ```bash
197
+ owfa add cuhksz # wraps kernel install + convergence
198
+ # equivalent, and more explicit:
199
+ python3 .meta/scripts/wiki_plugin_kernel.py install cuhksz --yes
200
+ ```
201
+
202
+ This is also what the agent's **plugin** command does: you can ask the agent to install a package by name, and it drives the same kernel. The CLI is the human/script equivalent.
203
+
204
+ What lands: plugin masters under `.meta/plugins/domains/<pkg>/`, command masters, in-repo connectors, skill copies, injection blocks, registry rows. Then the kernel converges. If the package declares a **first-run semantic migration** (root packages such as `project` do), the install stages it and `validate` stays red until an agent performs the semantic step:
205
+
206
+ ```bash
207
+ python3 .meta/scripts/wiki_plugin_kernel.py migrate <pkg>
208
+ # read the printed page, create the declaration/identity page, then:
209
+ python3 .meta/scripts/wiki_plugin_kernel.py migrate <pkg> --clear
210
+ ```
211
+
212
+ The CLI stops and reports this instead of pretending convergence. `owfa add` exits non-zero in that state.
213
+
214
+ Other forms:
215
+
216
+ - `kernel install <pkg>@<tag>` — pin a release tag;
217
+ - `kernel install <owner>/<repo> --yes` — an unindexed repository (trust: unknown; `--yes` is the trust gate);
218
+ - `kernel install <pkg> --path ./local-pkg` — a local package (channel C, no registry);
219
+ - `--without a,b` — subset grammar is reserved; v1 reports not-yet-open. Offline alternative: copy `domains/<pkg>/` into `.meta/plugins/domains/` and rerun `all`.
220
+
221
+ Trust levels are visible in `owfa list`: `framework-bundled` and `reviewed-3rd-party` install without a prompt; anything else needs `--yes` and is reported as unknown.
222
+
223
+ ### 7.3 Upgrade and uninstall packages
224
+
225
+ ```bash
226
+ python3 .meta/scripts/wiki_plugin_kernel.py upgrade # reconciliation report (read-only)
227
+ python3 .meta/scripts/wiki_plugin_kernel.py upgrade <pkg> --yes # silent reinstall, per package, never cascaded
228
+ python3 .meta/scripts/wiki_plugin_kernel.py uninstall <pkg> --yes
229
+ ```
230
+
231
+ - Package versions are release ordinals riding their own tags; member plugin versions do not lockstep.
232
+ - Upgrade stages semantic migrations when a version lands; clear them before the next mechanical action.
233
+ - Uninstall does the mechanical four-clear (masters, commands, connectors, skills) plus a residual scan; **data zones and credentials are never auto-deleted**. A declared teardown stages a semantic-deletion warning and a residual gate. See [packages.md](packages.md).
234
+
235
+ ## 8. Upgrade the framework
236
+
237
+ ### npm channel
238
+
239
+ ```bash
240
+ npx owfa upgrade # replace .meta/ + .agents/skills/ with the channel's version
241
+ npx owfa upgrade --check # read-only report
242
+ npx owfa upgrade --backup # keep a copy under .owfa/backup/<version>-<timestamp>/
243
+ ```
244
+
245
+ `upgrade` preserves the instance-local kernel state (`.meta/migrations/pending.json`, `.meta/kernel-journal.log`, `.meta/registry-cache.yaml`), replaces local edits under the two framework trees (instance hotfixes belong in git), and reruns `all`. A pending semantic migration blocks convergence and is reported with the exact `migrate` command.
246
+
247
+ ### git channel
248
+
249
+ Re-copy `.meta/` and `.agents/skills/` from the new template revision (review the diff, do not blind-copy over pending migrations), then `kernel all`. The instance git snapshot is the rollback path.
250
+
251
+ Framework versions are anchored by `.meta/VERSION` (0.3); a target-side semantic migration can be staged by an upgrade, with the same tri-face warning and `kernel migrate` flow.
252
+
253
+ ## 9. Uninstall
254
+
255
+ - **A package**: `kernel uninstall <pkg> --yes`; data zones stay, credentials are only reminded, never deleted.
256
+ - **The whole framework**: delete `.meta/`, `.agents/skills/`, and the `AGENTS.md` injection region block. `vault/` and `wiki/` are yours; dispose of them as you see fit. Nothing else is installed.
257
+
258
+ ## 10. Troubleshooting
259
+
260
+ | Symptom | Cause / fix |
261
+ |---|---|
262
+ | `Python 3.9+ not found` | install Python 3, or set `OWFA_PYTHON`; the installer is Node-only, the runtime is Python |
263
+ | `already contains .meta/` | it is an instance — `owfa upgrade`; `--force` re-copies the trees |
264
+ | `npx` runs an old version | `npx owfa@latest …`; npm caches by version range |
265
+ | `publish` / `npx` 403 on `owfa` | the name is frozen on similarity grounds; use the `owfadev` fallback or wait for the application |
266
+ | upgrade blocked by pending migrations | run `kernel migrate <pkg>`, perform the semantic step, then `--clear` |
267
+ | AGENTS markers missing | the AGENTS shell lost the `wiki-inject:start/end` pair; restore both, then `kernel all` |
268
+ | Windows: `python` opens the Store | install Python 3 and ensure `py -3` or `python3` works; `OWFA_PYTHON` overrides |
269
+ | kernel `list-remote` fails | network/raw access; the registry index is fetched from GitHub raw. The framework itself still works offline |
270
+
271
+ ## 11. File map after install
272
+
273
+ | Path | Purpose | Safe to edit by hand? |
274
+ |---|---|---|
275
+ | `AGENTS.md` | identity/layout (yours) + injection region (kernel) | outside the markers, yes |
276
+ | `vault/` | real assets | yes — the human owns it |
277
+ | `wiki/` | markdown world, proxies, notes, sessions | yes, via commands; derived pages are rebuilt |
278
+ | `wiki/index.md`, `tags.md`, `hot.md`, `log.md` | derived layer | no — the pipeline rewrites them |
279
+ | `.meta/plugins/` | Core plugins + installed packages | no — framework authoring |
280
+ | `.meta/scripts/` | kernel, pipeline, wikilib | no — framework authoring |
281
+ | `.meta/command/` | command masters | no |
282
+ | `.agents/skills/` | deployed skill copies | no — `kernel deploy` syncs them |
283
+ | `.meta/migrations/` | staged semantic migrations + ledger | no — kernel zone |
284
+ | `projects/` | project containers (if the project package is installed) | yes — project-owned |
285
+
286
+ ## 12. FAQ
287
+
288
+ - **Existing vault with content?** Additive: `init` creates/extends the framework trees, never touches your files. New assets go through `map`; whether to proxy old content is your decision, incrementally.
289
+ - **Can I use Obsidian?** Yes — it is a viewer. The framework writes plain markdown plus files; no plugin is required.
290
+ - **Can I copy the whole `.agents/` tree?** Yes; this repository's `.agents/` contains only `skills/`.
291
+ - **Windows?** Pure stdlib, no hardcoded paths; the CLI probes `py -3`. Git Bash or PowerShell both work.
292
+ - **Offline?** `npm pack` the CLI on a connected machine, copy the `.tgz`, `npm install -g ./owfa-x.y.z.tgz`, then `owfa init`. Packages can be copied as `domains/<pkg>/` and converged with `all`.
293
+ - **Multiple workspaces?** One instance per directory; they are independent. The CLI can init/upgrade any path.
294
+ - **Where do plugins come from?** The registry index; unindexed repos are installable with `--yes` (trust: unknown). See [packages.md](packages.md) for the package model and `PKG.yaml`.
295
+
296
+ ## Appendix — command cheatsheet
297
+
298
+ | Goal | Command |
299
+ |---|---|
300
+ | Install (target name) | `npx owfa init <dir>` |
301
+ | Install (fallback name) | `npx owfadev init <dir>` |
302
+ | Health check | `npx owfa doctor <dir>` |
303
+ | Framework upgrade | `npx owfa upgrade <dir>` (or `--check` / `--backup`) |
304
+ | Package catalog | `owfa list` / `kernel list-remote` |
305
+ | Installed packages | `owfa pkg` / `kernel pkg` |
306
+ | Install a package | `owfa add <pkg>` / `kernel install <pkg> --yes` |
307
+ | Package upgrade | `kernel upgrade` (report) / `kernel upgrade <pkg> --yes` |
308
+ | Package uninstall | `kernel uninstall <pkg> --yes` |
309
+ | Pending migrations | `kernel migrate` / `kernel migrate <pkg> --clear` |
310
+ | Structural check | `kernel validate` |
311
+ | Full convergence | `kernel all` |
@@ -0,0 +1,33 @@
1
+ # Developer guide: writing plugins & packages
2
+
3
+ > Where a plugin lives is decided by its `depends`, not by taste — and the dev loop is the same wherever it lives: clone → branch → hack → `--path` install into a sandbox → PR.
4
+
5
+ ## Where does my plugin land?
6
+
7
+ | Your plugin is… | It lands… | Trust gate |
8
+ |---|---|---|
9
+ | a **domain member** (depends chain reaches a domain root, e.g. bb-family) | that domain package's repo — PR there. Not a choice: the family closure claims it mechanically (`PKG.members` must include you or validate errors) | package maintainers |
10
+ | a **new domain** of its own | your own repo as a package (`PKG.yaml`, see [packages.md](packages.md)) + a one-line PR to the [registry](https://github.com/owfadev/registry) | the registry PR — the human-review gate (inject text and connectors are the security faces, #12) |
11
+ | **cross-cutting / non-domain** (global piece) | the framework repo's `core/` — PR there | owner review (charter-level, highest bar) |
12
+
13
+ A single plugin never ships bare — the package is the distribution unit. A lone plugin is a single-member package (12 lines of PKG.yaml, see email/bili/project). Users prune with `--without` (subset grammar), so contributing into a big package never forces users to install all of it.
14
+
15
+ ## The dev loop
16
+
17
+ 1. **Clone the target repo** (package repo for domain work, framework for core) and branch: `module/topic`
18
+ 2. **Hack** — manifest (PLUGIN.yaml) + PLUGIN.md + skills per the existing patterns; versions advance along the changelog
19
+ 3. **Integration-test without a monorepo**: in the sandbox (or any instance),
20
+ ```
21
+ cd test-repo
22
+ python .meta/scripts/wiki_plugin_kernel.py install <pkg> --path /path/to/your/clone
23
+ python .meta/scripts/wiki_plugin_kernel.py validate --scope <pkg>
24
+ ```
25
+ `--path` installs the local clone (channel C); iterate freely — reinstall after uninstalling, or just re-copy
26
+ 4. **PR** — one thing per commit, `模块: 概述`; self-check per [CONTRIBUTING](../../CONTRIBUTING.md) (framework root: `validate`; sandbox: `all`)
27
+ 5. **Release** (package repos): bump PKG.yaml `version`, tag `<pkg>-v<X.Y>`, then bump the registry line — two small PRs, on purpose: the registry never freezes with the framework
28
+
29
+ ## Discovery: how people (and agents) find your work
30
+
31
+ - **Before registration**: your repo is already installable (`kernel install <owner>/<repo> --yes`, trust: unknown) and findable via GitHub topics — tag the repo `owfa-package`
32
+ - **After the registry PR**: listed in `kernel list-remote` (the agent surface), installable without `--yes`, trust: reviewed-3rd-party
33
+ - **Write the summary for agents** — the registry `summary` line and your SKILL.md `description` fields are what agents actually match against; a vague summary is undiscoverable
@@ -0,0 +1,132 @@
1
+ # Distribution
2
+
3
+ > How the framework itself reaches a machine, and how it is upgraded. Packages have had a channel (registry + `kernel install`) since v0.3; the framework body had none — install was *clone, copy two trees, hand-write AGENTS.md*. This page records the npm channel that closes that gap.
4
+
5
+ ## Why npm
6
+
7
+ The framework is pure-stdlib Python with no runtime dependencies. npm is not a runtime choice here; it is a **delivery vehicle** chosen because it already exists on the machines that run agents:
8
+
9
+ - one command, no clone: `npx owfa init my-workspace` (target) / `npx owfadev init` (fallback while the npm name is under application)
10
+ - a versioned, immutable, checksummed artifact (the npm tarball) instead of a moving branch
11
+ - Windows does not need Python's script directory on `PATH` (the failure that motivated #46)
12
+ - `npx` keeps a cache, so re-running is cheap; upgrades fetch a new tarball by version
13
+ - no `postinstall` scripts: `npm install` executes nothing from this package
14
+
15
+ Python remains the only runtime dependency of the framework. Node is needed to *install*, not to *use*.
16
+
17
+ The name is part of the channel: **OWFA — One Workspace For All (agents)**, with **OWFA Core** as the framework body and **OWFA CLI** as this installer. The target package is `owfa`; the name is **frozen** under npm's similarity policy (too close to `ow` / `ora`), so publication waits on an application and the fallback package is `owfadev` (same code, bins `owfa` + `owfadev`). The GitHub home target is `owfadev/owfa`. See [naming.md](naming.md) for the layers and the collision policy.
18
+
19
+ ## What ships
20
+
21
+ The npm tarball is the framework body, byte-for-byte what the git channel copies:
22
+
23
+ | Path | Contents | In tarball |
24
+ |---|---|---|
25
+ | `.meta/` | kernel, plugins, commands, protocol, docs | yes |
26
+ | `.agents/skills/` | command/connector skill copies | yes |
27
+ | `templates/AGENTS.template.md` | the instance shell with the injection markers | yes |
28
+ | `bin/owfa.js` | CLI (zero dependencies) | yes |
29
+ | `README.md`, `LICENSE` | — | yes |
30
+ | `test/`, `scripts/`, `CONTRIBUTING.md`, `.github/` | development-only | no |
31
+
32
+ Local state never ships: `__pycache__`, `*.pyc`, `.meta/kernel-journal.log`, `.meta/migrations/pending.json`, `.meta/registry-cache.yaml`, `test-repo/`. The release gate (`scripts/verify-release.js`) refuses to publish if any of them would be packed.
33
+
34
+ ## Commands
35
+
36
+ ```
37
+ owfa init [dir] [--name NAME] [--packages a,b] [--force]
38
+ owfa upgrade [dir] [--check] [--backup] [--force]
39
+ owfa doctor [dir]
40
+ owfa add <pkg> [--yes] [--without a,b]
41
+ owfa list
42
+ owfa pkg
43
+ owfa version
44
+ ```
45
+
46
+ **init** — additive deployment, the five manual steps in [deployment.md](deployment.md) mechanized:
47
+
48
+ 1. copies `.meta/` and `.agents/skills/` from the tarball
49
+ 2. creates `vault/`, `wiki/notes/`, `wiki/sessions/`, `wiki/vault/`
50
+ 3. writes `AGENTS.md` from the template when absent; when one exists, **appends only the injection region** (handwritten content before it is preserved byte-for-byte); refuses if the markers are half-present
51
+ 4. runs `python .meta/scripts/wiki_plugin_kernel.py all` (validate, inject, registry, skills)
52
+ 5. optionally installs packages from the registry (`--packages cuhksz,lark`)
53
+
54
+ A package may declare a **first-run semantic migration** (root packages such as `project` do). Installing it stages the migration, and the CLI stops there with the exact `kernel migrate` command — clearing it is an agent act (create the identity/declaration page), not something a mechanical installer may fake. `init --packages` therefore exits non-zero in that state: the workspace is installed but not converged.
55
+
56
+ `--force` re-copies the framework trees over an existing instance, preserving the kernel state listed below. Instance data (`vault/`, `wiki/`) is never touched by any `init` or `upgrade`. If `.agents/skills/` already exists, framework skill copies with the same names are updated in place; unrelated skills are left alone.
57
+
58
+ **upgrade** — tree replacement plus convergence:
59
+
60
+ - compares the instance's `.meta/VERSION` with the tarball's; refuses downgrades unless `--force`
61
+ - preserves instance-local kernel state: `.meta/migrations/pending.json`, `.meta/kernel-journal.log`, `.meta/registry-cache.yaml`
62
+ - **replaces** local edits under `.meta/` and `.agents/skills/` — instance hotfixes belong in the instance's git history, which is the rollback path (the `--backup` flag also drops a copy under `.owfa/backup/<version>-<timestamp>/`)
63
+ - reruns `all`; a pending semantic migration blocks convergence and is reported with the exact `kernel migrate` command
64
+ - `--check` is a read-only report
65
+
66
+ **doctor** — prints Node/Python/framework versions, checks the AGENTS injection markers, runs `kernel validate`. It never writes.
67
+
68
+ **add** — thin wrapper over `kernel install` plus convergence. Registry trust rules still apply; `--yes` is forwarded. A staged first-run migration stops the command with the exact `migrate` hint (exit non-zero) instead of a false "done".
69
+
70
+ **list** — `kernel list-remote`: the registry catalog with package versions, framework compat floors, member plugins, trust levels and installed marks. **pkg** — `kernel pkg`: what is installed in this instance (packages, members, connectors, core remainder).
71
+
72
+ ## Version invariant
73
+
74
+ The npm version rides the framework anchor: `.meta/VERSION` `0.3` → package `0.3.x`. The release gate refuses a package whose `major.minor` diverges, and refuses a `v*` tag that does not match the package version exactly. `.meta/VERSION` still tracks the kernel contract, not product maturity (stage labels live in the README); npm patch releases may fix packaging without touching the contract.
75
+
76
+ Install identification is therefore trivial: `.meta/VERSION` says which framework a workspace is on; `owfa version` says which channel the CLI is on.
77
+
78
+ ## Release runbook
79
+
80
+ One-time:
81
+
82
+ 1. Settle the public home: create the `owfadev` GitHub org and move the repo to `owfadev/owfa` (a transfer, not a copy; GitHub redirects the old URL). Update `package.json` `repository`/`homepage` and the README links in the same commit.
83
+ 2. Apply to npm support for `owfa` (frozen on similarity grounds), with the org/repo, the docs and this channel as evidence. A 404 is not availability.
84
+ 3. Create the npm account/org that will publish; if the application is not granted, publish the fallback `owfadev` (bins `owfa` + `owfadev`) and keep `owfa` as the brand.
85
+ 4. Add `NPM_TOKEN` as a repository secret (automation token with publish rights), or run `npm login` locally for a manual first release.
86
+
87
+ Every release:
88
+
89
+ ```bash
90
+ # 1. the framework contract and the package version move together
91
+ $EDITOR .meta/VERSION # e.g. 0.3 -> 0.4
92
+ $EDITOR package.json # "version": "0.4.0"
93
+ git commit -am "release: framework 0.4.0"
94
+ git tag v0.4.0 && git push --follow-tags
95
+ ```
96
+
97
+ The tag triggers `.github/workflows/publish.yml`, which re-runs the release gate, publishes with `--provenance`, and fails closed on any mismatch. For a manual release: `npm publish --access public --provenance`.
98
+
99
+ Before tagging, run locally:
100
+
101
+ ```bash
102
+ node scripts/verify-release.js
103
+ node test/smoke.js
104
+ npm pack --dry-run
105
+ ```
106
+
107
+ ## Security posture
108
+
109
+ - **Zero dependencies** — nothing to audit but this package.
110
+ - **No consumer lifecycle scripts** — `prepublishOnly` runs for the publisher only; installing or running `owfa` never executes package scripts.
111
+ - **Provenance** — CI publishes with npm provenance, binding the tarball to this repository and commit.
112
+ - **Additive by default** — `init` only appends to `AGENTS.md`; all destructive replacement is explicit (`upgrade`, `--force`) and reversible through instance git.
113
+ - **No telemetry** — the CLI talks to npm only when npm itself does; `init`/`upgrade` do not phone home. Package installs from the registry are the kernel's existing GitHub-based channel, unchanged.
114
+
115
+ ## Scope and non-goals (v1)
116
+
117
+ - Domain packages stay on the registry/`kernel install` channel. `owfa add` is a convenience wrapper, not a second package format.
118
+ - No self-update of the CLI from inside the CLI; `npx owfa@latest` is the update path.
119
+ - No platform installers (Homebrew, apt, pipx). The npm tarball is the single artifact; a PyPI mirror can be added later without changing the payload.
120
+ - Offline install: `npm pack` on a connected machine, copy the `.tgz`, `npm install -g ./owfa-x.y.z.tgz`, then `owfa init`.
121
+ - The git channel remains fully supported: clone-as-instance and developer template workflows are unchanged.
122
+
123
+ ## Troubleshooting
124
+
125
+ | Symptom | Cause / fix |
126
+ |---|---|
127
+ | `Python 3.9+ not found` | install Python 3, or set `OWFA_PYTHON=/path/to/python3`; the installer itself is Node-only |
128
+ | `already contains .meta/` | the directory is already an instance — use `owfa upgrade`; `--force` re-copies the trees |
129
+ | `npx` runs an old version | `npx owfa@latest …`; npm caches by version range |
130
+ | upgrade blocked by pending migrations | run `python .meta/scripts/wiki_plugin_kernel.py migrate <pkg>` and follow the printed page before upgrading again |
131
+ | publish fails: name too similar | npm froze `owfa` (similar to `ow`/`ora`); use the `owfadev` fallback or wait for the application; do not retry the same name |
132
+ | Windows: `python` opens the Store | install Python 3 and ensure `py -3` or `python3` works; `OWFA_PYTHON` overrides detection |
@@ -0,0 +1,56 @@
1
+ # Introduction
2
+
3
+ > Reader: team members, contributors, and anyone who wants to understand this design. For what the mechanics *are*, the authoritative sources are the kernel reference skill and the AGENTS.md injection region. This document explains *why* we arrived here: narrative and lineage, not a mirror of the mechanics. Written 2026-10-04.
4
+
5
+ ## 1. The starting problem
6
+
7
+ In every session, the agent acquires information in SASU-L order: system prompt, AGENTS.md, Skills, the user's own words, loop. The system prompt carries no information about the vault; users assume the agent remembers last time, which is impossible. Cross-session information acquisition can only rely on the agent actively reading, and in real deployments the agent has zero prior knowledge of the vault. The pain of using an AI assistant is often not a lack of intelligence, but having to reintroduce yourself every time: where your assets are, what you are studying, where the last decision left off.
8
+
9
+ ## 2. The file foundation
10
+
11
+ Markdown plus plain files is the foundation. No tool-private formats; Obsidian and WebUIs are merely replaceable viewers. Now the agent can read the vault—but "being able to read" is not "knowing what to read". Reading without signposts is blind: read everything and the context explodes; miss a read and information goes dark. What the framework solves is not storage, but the structure of information disclosure.
12
+
13
+ ## 3. The pointer mechanism
14
+
15
+ Pointers are low-cost signposts resident in context: location and summary are always present, and the summary is the entire source of filtering efficiency; trigger conditions and post-trigger actions are paired as needed. Progressive disclosure has three layers: pointers stay resident at minimal context cost; the pointed-to targets are read on demand; referenced material is drilled into further. index drilling down level by level is exactly this structure.
16
+
17
+ Two corollaries run through the whole framework:
18
+
19
+ - **Never hand-write what can be derived**. Hand-written pointers rot—targets move, descriptions go stale; derived pointers are mechanically regenerated, immune to rot. This is the philosophical starting point of one source, five projections
20
+ - **The ultimate purpose of disclosure is not "can be found", but "recalled when it should be recalled"**. todo is the explicit instance of a time-dimension pointer, pointing at what should be recalled at some future moment; injection lines carrying a "when to read first" condition are proactive pointers; consumes brings rules on-site when a command triggers—the same idea
21
+
22
+ ## 4. Pluginization
23
+
24
+ The architecture does not enumerate. File formats and note types do not enter the constitution—types are frontmatter fields; structure is specified by each plugin on its own. One plugin, one directory: the manifest is the machine-readable essence; PLUGIN.md records the design rationale; attached-audit scripts are optional. A plugin holds a territory—which slice of paths belongs to whom, and what the write model is—and holds the outward-facing fields and disciplines.
25
+
26
+ The domain is the core abstraction. wiki recognizes only inside versus outside; an external domain is an adapter contract, embodied in six questions: external territory, landing strategy, identity proof, wiki territory, write model, trust model. Landing is essentially a write-model choice: final-state assets go into append-only storage; process containers get full read-write authority; when the truth lives elsewhere, use pointers. Borrowing vault or pointers is the default posture; a self-standing container is the exception.
27
+
28
+ ## 5. Projections
29
+
30
+ One set of manifests is mechanically projected to five places: the AGENTS injection region; the check inspection blocks; the command usage blocks, ordered by consumes; the registry field section; the deployed skill copies. All are idempotently rebuilt, automatically synchronized on (un)install, and presence is registration. There is no second source of truth: to change the contract, change the manifest, and one command converges everything. A deployed instance is self-sufficient carrying only the injection region and skills—mechanism documentation lives in the runtime-visible surface, and no separate set of architecture documents that would drift is written.
31
+
32
+ ## 6. Layering and bridges
33
+
34
+ - **Material layer vs. archive layer**: process artifacts live in domain workspaces—fetched material, notes, graded quizzes all included; distilled conclusions live in the wiki. The wiki receives distillates, not process
35
+ - **Global components vs. domain components**: cross-cutting services and their homes are global components—trust, log, todo, calendar, notes, user-profile—which may declare bridges; domain components belong to a domain transitively via depends. The bridge carries validation and declaration—required-bridge completeness, optional-bridge tolerance; disclosure distribution belongs to the projections
36
+ - **Collection channels**: consumer-side plugins can take the thinnest form—zero territory, pure workflow, with usage routed via the source side and aggregated on-site at the hub command. Teaching and quizzing both close the loop around the cognition profile
37
+
38
+ ## 7. The team turn
39
+
40
+ On 2026-10-02 the project switched from personal use to a team project. Collaboration red lines—data boundaries, git discipline, the commit process—see the "User requirements" section of AGENTS.md, whose authority always remains AGENTS.md itself. Development artifacts enter git; instance data never does. The framework is a universal product; real courses, grades, privacy, and credentials belong to the deployment instance.
41
+
42
+ ## 8. Lineage and map
43
+
44
+ A minimal chronology: 2026-08 the personal vault founded; 09-08 the prototype landed, plugins plus commands; 09-12 the validate-by-use ruling; 09-19 to 09-30 domainization and connectors; 10-02 the team turn and governance rules; 10-04 the cognition consumer side established and mechanism documentation opened. For the full stream see `log.md` and git history.
45
+
46
+ | Want to know | Go read |
47
+ |---|---|
48
+ | Constitution and collaboration red lines | `AGENTS.md` |
49
+ | Mechanics overview | the kernel reference skill |
50
+ | How the mechanics work | `.meta/docs/mechanics.md` |
51
+ | Daily usage | `.meta/docs/usage.md` |
52
+ | Using the sandbox | `.meta/docs/sandbox.md` |
53
+ | Why a plugin is designed this way | that plugin's `PLUGIN.md` |
54
+ | Research basis | `.meta/docs/research-*.md` |
55
+ | Deployment guide | `.meta/docs/deployment.md` (five-minute path: `.meta/docs/quickstart.md`) |
56
+ | Run history and current state | `log.md` |
@@ -0,0 +1,19 @@
1
+ # log.md — instance seed example
2
+
3
+ > The run log of an instance (the framework repo itself keeps none — its change trail is git history + PRs + issues). Created by the log command on first write; the agent never rewrites old entries.
4
+
5
+ ```markdown
6
+ # 运行日志
7
+
8
+ > 置顶追加、只增不删;条目 = `- YYYY-MM-DD <类型> [<域>]:一句话`(域标可缺省——无域事务,log 桥)。规则见 `.meta/plugins/core/log/`,写走 `pipeline.py log`。
9
+
10
+ - 2026-10-12 other:<one sentence: what happened, from which domain, with what outcome>
11
+ - 2026-10-12 map:<one sentence per mapping transaction>
12
+ - 2026-10-11 save:<one sentence per note landed, with the page name>
13
+ ```
14
+
15
+ Shape rules:
16
+
17
+ - **Prepend at the top, never rewrite** — the log is append-only history; window overflow is archived mechanically to `wiki/archive/<month>/log.md`, never trimmed by hand
18
+ - **One transaction, one line** — type (`map/save/query/check/plugin/todo/profile/other`) + optional `[domain]` tag + one sentence; evidence and detail live on pages, the log records that they happened
19
+ - Write through the pipeline (`pipeline.py log <type> <text>`), which enforces the window and the archive; hand edits are legitimate for humans but keep the format
@@ -0,0 +1,23 @@
1
+ # Docs map — what to read when
2
+
3
+ > The routing table for `.meta/docs/` (framework) and package-repo docs. The entry index for agents; skills point here, the documents stay the source of truth.
4
+
5
+ | Situation | Read |
6
+ |---|---|
7
+ | User reports dissatisfaction with agent behavior; behavior self-audit | [agent-behavior.md](agent-behavior.md) — feedback handling (consent gate) → routing → the seven-step standard |
8
+ | Filing feedback — which repo owns it | [agent-behavior.md](agent-behavior.md) §Routing |
9
+ | How packages / install / upgrade / migrations work (design + decision ledger) | [packages.md](packages.md) |
10
+ | Deploying an instance; components (CLI/Core/kernel); channels; packages; upgrades; troubleshooting | [deployment.md](deployment.md) |
11
+ | Five-minute install path | [quickstart.md](quickstart.md) |
12
+ | Installing/upgrading the framework body; npm channel; release runbook | [distribution.md](distribution.md) |
13
+ | The name: OWFA expansion, two names two jobs, collision policy | [naming.md](naming.md) |
14
+ | Converting a legacy (pre-split flat) instance to the package era | [conversion.md](conversion.md) — the eight-step drill walked on a real instance |
15
+ | Instance git usage (snapshots, red lines, recovery) | the [instance-git plugin](../plugins/core/instance-git/PLUGIN.md) (core 21) |
16
+ | Framework mechanics: projections, bridges, injection, inject tiers | [mechanics.md](mechanics.md) |
17
+ | (Un)install history, package lifecycle | [mechanics.md](mechanics.md) §7 + [packages.md](packages.md) |
18
+ | Experiments: sandbox or local | [sandbox.md](sandbox.md) |
19
+ | Development rules, commit flow, template + instance workflow | [CONTRIBUTING.md](../../CONTRIBUTING.md) — template-repo root (an instance reads it there, never keeps a copy) |
20
+ | Day-to-day usage loops | [usage.md](usage.md) |
21
+ | What the framework is, intro | [intro.md](intro.md) |
22
+ | Package-side plugin docs (bb family, lark family, …) | the owning `pkg-*` repo's plugin masters |
23
+ | AGENTS.md seed / log seed examples | [agents-example.md](agents-example.md), [log-example.md](log-example.md) |