@aitne-sh/aitne 0.1.5 → 0.1.6

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 (77) hide show
  1. package/README.md +16 -0
  2. package/agent-assets/agent-profiles/_safety.md +17 -2
  3. package/agent-assets/agent-profiles/routine-fetch-window.md +75 -40
  4. package/agent-assets/agent-profiles/wiki-agent.md +19 -0
  5. package/agent-assets/docs/features/messaging/bang-commands.md +161 -0
  6. package/agent-assets/docs/features/messaging/overview.md +3 -0
  7. package/agent-assets/docs/features/wiki/commands.md +222 -0
  8. package/agent-assets/docs/features/wiki/overview.md +145 -0
  9. package/agent-assets/docs/getting-started/03-what-can-this-do.md +18 -0
  10. package/agent-assets/docs/glossary.md +34 -0
  11. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +123 -0
  12. package/agent-assets/docs/guides/build-your-wiki.md +99 -0
  13. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +169 -0
  14. package/agent-assets/docs/guides/maintain-wiki-health.md +168 -0
  15. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +192 -0
  16. package/agent-assets/docs/guides/pause-the-agent.md +10 -3
  17. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +156 -0
  18. package/agent-assets/docs/reference/cli-commands.md +24 -1
  19. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +96 -0
  20. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +82 -0
  21. package/agent-assets/skills/context/SKILL.md +288 -17
  22. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +2 -2
  23. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +3 -3
  24. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +6 -6
  25. package/agent-assets/skills/external-services/SKILL.md +5 -3
  26. package/agent-assets/skills/external-services/SKILL.native.claude.md +49 -58
  27. package/agent-assets/skills/external-services/SKILL.native.codex.md +50 -58
  28. package/agent-assets/skills/external-services/SKILL.native.gemini.md +53 -56
  29. package/agent-assets/skills/mail/SKILL.md +5 -5
  30. package/agent-assets/skills/mail/SKILL.native.claude.md +57 -65
  31. package/agent-assets/skills/mail/SKILL.native.codex.md +73 -75
  32. package/agent-assets/skills/mail/SKILL.native.gemini.md +80 -75
  33. package/agent-assets/skills/management-task-register/SKILL.md +3 -3
  34. package/agent-assets/skills/notion/SKILL.native.claude.md +78 -82
  35. package/agent-assets/skills/notion/SKILL.native.codex.md +78 -80
  36. package/agent-assets/skills/notion/SKILL.native.gemini.md +91 -90
  37. package/agent-assets/skills/observations/SKILL.md +104 -14
  38. package/agent-assets/skills/roadmap/SKILL.md +19 -0
  39. package/agent-assets/skills/schedule/SKILL.md +44 -3
  40. package/agent-assets/skills/today/SKILL.md +25 -5
  41. package/agent-assets/skills/travel-time/SKILL.md +9 -0
  42. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +32 -0
  43. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +126 -0
  44. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +75 -0
  45. package/agent-assets/skills/wiki/wiki-graduate/SKILL.md +45 -0
  46. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +182 -0
  47. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +90 -0
  48. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +72 -0
  49. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +145 -0
  50. package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +28 -9
  51. package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +26 -9
  52. package/agent-assets/task-flows/_partials/mail-acquire.gmail.md +51 -24
  53. package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +46 -16
  54. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +29 -9
  55. package/agent-assets/task-flows/message.received.dm.md +35 -2
  56. package/agent-assets/task-flows/message.received.dm.native.claude.md +25 -26
  57. package/agent-assets/task-flows/message.received.dm.native.codex.md +30 -24
  58. package/agent-assets/task-flows/message.received.dm.native.gemini.md +36 -36
  59. package/agent-assets/task-flows/message.received.dm_first.md +43 -4
  60. package/agent-assets/task-flows/message.received.dm_first.native.claude.md +20 -20
  61. package/agent-assets/task-flows/message.received.dm_first.native.codex.md +22 -19
  62. package/agent-assets/task-flows/message.received.dm_first.native.gemini.md +28 -24
  63. package/agent-assets/task-flows/routine.fetch_window.md +51 -36
  64. package/agent-assets/task-flows/routine.morning_routine.md +12 -3
  65. package/agent-assets/task-flows/routine.morning_routine_initial.md +22 -1
  66. package/agent-assets/task-flows/scheduled.dm.md +477 -0
  67. package/agent-assets/task-flows/wiki.ask.md +11 -0
  68. package/agent-assets/task-flows/wiki.compile.md +28 -0
  69. package/agent-assets/task-flows/wiki.connect.md +12 -0
  70. package/agent-assets/task-flows/wiki.ingest_url.md +35 -0
  71. package/agent-assets/task-flows/wiki.lint.md +13 -0
  72. package/agent-assets/task-flows/wiki.trace.md +13 -0
  73. package/agent-assets/wiki-seeds/schemas/output.md +12 -0
  74. package/agent-assets/wiki-seeds/schemas/raw.md +13 -0
  75. package/agent-assets/wiki-seeds/schemas/wiki.md +12 -0
  76. package/agent-assets/wiki-seeds/taxonomy.md +13 -0
  77. package/package.json +21 -41
package/README.md CHANGED
@@ -131,6 +131,20 @@ A non-exhaustive list. Click any group to expand.
131
131
  - Auto-link new notes to existing concepts ("this is related to your `agent-architecture.md` from March")
132
132
  </details>
133
133
 
134
+ <details>
135
+ <summary><b>🧠 Build a personal wiki from anything you DM</b></summary>
136
+
137
+ - Send a URL with `!ingest https://...` — the agent fetches, summarises, and saves a raw note in `10_raw/`
138
+ - Run `!compile` to synthesise raw notes into linked wiki articles in `20_wiki/` with an auto-maintained `_index.md`
139
+ - `!compile --preview` shows added / modified / unchanged pages plus cost and ETA *before* you spend tokens
140
+ - `!compile full` rebuilds everything — cost-gated, with a dashboard approval queue and an optional git pre-compile snapshot for external vaults
141
+ - `!ask <question>` answers from your own wiki and writes the cited reply to `30_outputs/`
142
+ - `!lint` audits for orphans, broken links, schema drift, and taxonomy candidates → dated health report
143
+ - `!trace <topic>` and `!connect A B` reconstruct how an idea evolved and find shared structure across domains
144
+ - Run multiple workspaces (`!ingest @research ...`, `!compile @ops full`) — the default workspace falls through when the `@` token is omitted
145
+ - Workspaces can be internal (`~/.personal-agent/wiki/`) or an external Obsidian vault you already keep
146
+ </details>
147
+
134
148
  <details>
135
149
  <summary><b>📦 Code, Git, GitHub</b></summary>
136
150
 
@@ -410,6 +424,7 @@ flowchart TB
410
424
  | 🧠 **Multi-backend brain** | Claude (Opus 4.7 / Sonnet 4.6 / Haiku 4.5) · Codex CLI · Gemini CLI |
411
425
  | 📝 **MD-centric memory** | Plain Markdown you own — `today.md` · `roadmap.md` · `projects/*` · `daily/` · `weekly/` · `monthly/` |
412
426
  | 🔌 **23 built-in skills** | Calendar, mail, Notion, Obsidian, schedule, roadmap, receipts, travel, reading, voice, … |
427
+ | 🧠 **Personal wiki builder** | DM `!ingest <url>` to capture, `!compile` to synthesise, `!ask` / `!lint` / `!trace` / `!connect` to operate — across one or many workspaces |
413
428
  | 🔁 **4-mode integration framework** | `direct` (daemon polls) · `delegated` (backend's connector) · `native` (main backend MCP on demand) · `disabled` |
414
429
  | 🛡️ **Four-layer safety** | SDK allowlist · PreToolUse hooks · daemon API risk tiers · absolute-block layer that holds even in Allow mode |
415
430
  | 🪪 **Local-first & private** | Binds to `127.0.0.1`. No telemetry. Secrets in OS Keychain. Zero cloud state. |
@@ -823,6 +838,7 @@ Local FTS5 full-text search runs across **every** account via `GET /api/mail/sea
823
838
 
824
839
  - **Obsidian** — read directly via `Read`; write via the official Obsidian CLI (`obsidian create`, `obsidian append`, `obsidian daily:append`, …); `chokidar` watches the vault for user edits
825
840
  - **Notion** — `@notionhq/client` REST API; full page + database CRUD
841
+ - **Wiki builder** — per-workspace ingest / compile / ask / lint / trace / connect surface backed by `packages/daemon/src/core/wiki/` (cost-gated full rebuilds, approval queue, compile preview, optional git pre-compile snapshot, dispatch-mode fan-out). One internal workspace or any number of external Obsidian vaults; addressed with `@<workspace>` on every bang command. See `agent-assets/docs/features/wiki/overview.md`.
826
842
  - **Custom MCP servers** — register via `/api/mcp/servers`; materialized into the per-session workdir so backends use them transparently
827
843
 
828
844
  ### Code
@@ -24,12 +24,27 @@
24
24
  - **Read-before-write**: PATCH `mode=replace` replaces the entire section.
25
25
  Always GET first, merge your changes into the existing content, then PATCH.
26
26
  Prefer `mode=append` when simply adding new entries.
27
+ - **Every Bash invocation that hits the daemon API MUST begin with the
28
+ literal `curl` token.** The session's allow-list is `Bash(curl *)`,
29
+ prefix-matched against the FULL command string under `dontAsk`. Any
30
+ wrapping shape is silently denied (no tool result, no error — the
31
+ call simply does not run):
32
+ - `echo '{...}' | curl ...` → starts with `echo` → denied
33
+ - `cat <<JSON | curl -d @-` → starts with `cat` → denied
34
+ - `bash -c "curl ..."` / `( curl ... )` / `var=x curl ...` → denied
35
+ - `curl ... ; curl ...` / `curl ... && curl ...` → chained-curl denied
36
+ Write a single, flat curl call. If you see no response from Bash at
37
+ all (no stdout, no stderr, no `PA_API_ERROR`), your command was
38
+ silently denied — rewrite it to start with literal `curl`.
27
39
  - **Daemon-API body submission** (`curl -d` on `/api/context/*`,
28
40
  `/api/observations`, `/api/schedule`, etc.). Two safe shapes:
29
41
  - Inline JSON — `-d '{"key":"value"}'`. Use for small / single-line
30
42
  bodies. Escape internal newlines as `\n`.
31
- - Stdin heredoc — `-d @- <<'JSON' … JSON`. Use for multi-line or
32
- large bodies. `@-` is curl's stdin marker (a literal two-character
43
+ - Stdin heredoc on the SAME curl line `curl ... -d @- <<'JSON'`
44
+ + body + `JSON`. Note: the heredoc is redirected into `curl`'s
45
+ stdin so the command still STARTS with `curl`; do NOT pipe from
46
+ `cat <<JSON | curl …` (that starts with `cat` and is silently
47
+ denied). `@-` is curl's stdin marker (a literal two-character
33
48
  token), distinct from the file-read forms below.
34
49
 
35
50
  Never use `-d @<filepath>` / `--data-raw '@<filepath>'` /
@@ -7,7 +7,9 @@ mechanical.
7
7
  ## Principles
8
8
  - **Fetch, don't think.** Read the `<acquisition-plan>` block in your prompt.
9
9
  It enumerates `(integration, mode, window, account?)` tuples. For each row,
10
- perform the matching fetch and POST results to `/api/observations`.
10
+ perform the matching fetch and POST results to `/api/observations/batch`
11
+ in a **single** call per window (the contract is in the integration
12
+ partial below).
11
13
  - **Trust the routing the daemon resolved for you.** The plan already encodes
12
14
  the per-(integration, mode) path. Do not second-guess: do not probe MCP
13
15
  registries, do not list "common tool names", do not guess. The integration
@@ -18,6 +20,13 @@ mechanical.
18
20
  `/api/observations` after you return and populates `summary_text` /
19
21
  `novelty_score`. Do not summarize, rank, or filter — your output is the
20
22
  raw payload.
23
+ - **Batch in one curl per window.** Each acquired window goes out as a
24
+ single `POST /api/observations/batch` call with up to 200 observations
25
+ in the `observations[]` array. Do NOT loop over items in a shell `for`,
26
+ do NOT write a script under `/tmp/` and pipe / source / bash it, do NOT
27
+ chain multiple `curl` invocations in one Bash call. Those shapes are
28
+ blocked by the daemon's Bash hooks and burn pre-pass turns to no
29
+ effect. One window → one curl → one JSON body with an array.
21
30
  - **Never write to context MD files.** today.md, weekly/, journal, schedule —
22
31
  all of that belongs to the parent routine session, not to you.
23
32
  - **Single JSON line on stdout.** When done, print exactly one JSON object
@@ -27,8 +36,15 @@ mechanical.
27
36
 
28
37
  ## Fetch routing summary
29
38
 
30
- For each `<fetch integration="…" mode="…" window="…" account="…">` row in
31
- `<acquisition-plan>`, route by `mode`:
39
+ For each `<fetch integration="…" mode="…" window="…" [account="…"]>` row in
40
+ `<acquisition-plan>`, route by `mode`. The `account` attribute is only
41
+ present in `direct` mode (where the daemon stores per-account OAuth
42
+ tokens); in `delegated-same` / `delegated-cross` / `native` modes the bound
43
+ MCP authenticates as a single user, so the dispatcher emits a single row
44
+ without an `account` attribute and the partial substitutes `"default"`
45
+ wherever the observation source / providerId references `<accountId>`.
46
+
47
+ Route by `mode`:
32
48
 
33
49
  - **direct** — call the daemon REST endpoint named by the integration
34
50
  partial (`/api/mail/...`, `/api/calendar/events`, `/api/notion/...`,
@@ -47,44 +63,55 @@ For each `<fetch integration="…" mode="…" window="…" account="…">` row i
47
63
  If the partial for an integration is missing or the row has no usable
48
64
  surface (e.g. user picked native for Outlook Mail without binding any
49
65
  Outlook surface), record
50
- `{"type":"no-surface","integration":"<key>","account":"<id>"}` in `errors`
51
- and continue. Never halt the pre-pass the parent routine continues
52
- with whatever observations the rest of the plan produced.
66
+ `{"type":"no-surface","integration":"<key>","account":"<id>"}` in
67
+ `errors` (use the literal string `"default"` for `account` when the
68
+ `<fetch>` row has no `account` attribute) and continue. Never halt the
69
+ pre-pass — the parent routine continues with whatever observations the
70
+ rest of the plan produced.
53
71
 
54
72
  ## Observation POST contract
55
73
 
56
- For every fetched item, POST to `/api/observations`:
74
+ For every fetched window, POST a batched array to
75
+ `/api/observations/batch` (one curl per window, up to 200 items per call):
57
76
 
58
77
  ```json
59
78
  {
60
- "source": "<integrationKey>:<accountOrScope>",
61
- "ref": "<provider-side stable id>",
62
- "changeType": "created",
63
- "actor": "agent",
64
- "payload": {
65
- "kind": "mail" | "calendar" | "notion",
66
- "providerId": "<account id>",
67
- "raw": { /* compact subset: subject/from/snippet/date for mail,
68
- title/start/end/attendees for calendar,
69
- title/last_edited/parent for notion */ }
70
- }
79
+ "observations": [
80
+ {
81
+ "source": "<integrationKey>:<accountOrScope>",
82
+ "ref": "<provider-side stable id>",
83
+ "changeType": "created",
84
+ "actor": "agent",
85
+ "payload": {
86
+ "kind": "mail" | "calendar" | "notion",
87
+ "providerId": "<account id>",
88
+ "raw": { /* compact subset: subject/from/snippet/date for mail,
89
+ title/start/end/attendees for calendar,
90
+ title/last_edited/parent for notion */ }
91
+ }
92
+ },
93
+
94
+ ]
71
95
  }
72
96
  ```
73
97
 
74
- - `actor` MUST be `"agent"`. The server rejects `"user"`.
98
+ - `actor` on every element MUST be `"agent"`. The server rejects `"user"`.
75
99
  - Do NOT compute or supply a dedup hash; the server computes
76
- `contentHash` from `(source, payload)` and returns it in the
77
- response.
78
- - The response distinguishes three outcomes via `action` (on 200) or
79
- `error` (on 409). Count each into the report:
80
- - `200 {action: "created"}` `posted++`
81
- - `200 {action: "modified"}` `posted++` (server updated the
82
- existing `(source, ref)` pending row with a different payload)
83
- - `409 {error: "duplicate"}` → `duplicates++` (identical payload
84
- already pending no row was written, no summarizer re-enqueue)
85
- - `409 {error: "integration_flip_in_progress"}` → append
86
- `{type:"flip-locked", integration:"<key>", …}` to `errors` and
87
- move on; do NOT retry inline (the next routine tick will).
100
+ `contentHash` from `(source, payload)` and returns it per item.
101
+ - The batch endpoint always returns `200` with envelope
102
+ `{ "results": [{index, status, ref, source, contentHash?, id?, error?}, …],
103
+ "fetched": N, "posted": N, "duplicates": N, "errors": N }`. Roll the
104
+ envelope's `posted` / `duplicates` into your running totals; for each
105
+ `results[*].status` other than `"created"` / `"modified"` / `"duplicate"`,
106
+ append the appropriate `errors[]` entry per the partial.
107
+ - `"created"` / `"modified"` → already in envelope's `posted`.
108
+ - `"duplicate"` → already in envelope's `duplicates`.
109
+ - `"flip_locked"` → append
110
+ `{type:"flip-locked", integration:"<key>", …}` to `errors`; do NOT
111
+ retry inline (the next routine tick will).
112
+ - `"validation_error"` → append
113
+ `{type:"validation-error", integration:"<key>", ref:"<ref>",
114
+ detail:"<results[*].error>"}` to `errors`.
88
115
  - For an item whose payload differs from a prior pending row with the
89
116
  same `(source, ref)`, send `changeType: "modified"` — the server
90
117
  detects identical payloads via the canonical contentHash regardless
@@ -92,6 +119,9 @@ For every fetched item, POST to `/api/observations`:
92
119
  consumers, not part of the dedup signal.
93
120
  - For a deletion, send `changeType: "deleted"` with a minimal payload
94
121
  (`{"kind":"…","providerId":"…","raw":{"deletedAt":"<iso>"}}`).
122
+ - If the upstream call returns more than 200 items for a single window,
123
+ split into multiple `POST /api/observations/batch` calls of at most
124
+ 200 entries each.
95
125
 
96
126
  ## Boundaries
97
127
  - Do NOT call `/api/context/*` (write or read) — that surface belongs to
@@ -113,16 +143,21 @@ Print exactly one JSON line on stdout, then terminate:
113
143
 
114
144
  Field semantics:
115
145
  - `fetched` — total items returned by upstream APIs across all rows.
116
- - `posted` — count of 200 responses (`action {created, modified}`).
117
- - `duplicates` count of `409 {error:"duplicate"}` responses
118
- (canonical `(source, payload)` already pending).
146
+ - `posted` — sum of the batch endpoint's envelope-level `posted`
147
+ counter across every `POST /api/observations/batch` call you make
148
+ (i.e. `results[*].status ∈ {"created","modified"}`).
149
+ - `duplicates` — sum of the batch endpoint's envelope-level `duplicates`
150
+ counter (i.e. `results[*].status == "duplicate"`).
119
151
  - `errors` — array of `{type, ...}` records. Common types:
120
- - `no-surface` — the row points at an in-session connector that
121
- isn't bound on this backend.
122
- - `flip-locked` — `409 {error:"integration_flip_in_progress"}`;
123
- the integration is mid-flip and the write was rejected.
124
- - `unexpected-row` — `mode="disabled"` slipped past the daemon filter.
125
- - `fetch-failed` upstream API returned non-2xx;
152
+ - `no-surface` — the row points at an in-session connector
153
+ that isn't bound on this backend.
154
+ - `flip-locked` — `results[*].status == "flip_locked"`; the
155
+ integration is mid-flip. Do NOT retry inline — the next routine
156
+ tick reaps it.
157
+ - `validation-error` `results[*].status == "validation_error"` for
158
+ a malformed item; copy `detail` from `results[*].error`.
159
+ - `unexpected-row` — `mode="disabled"` slipped past the daemon filter.
160
+ - `fetch-failed` — upstream API returned non-2xx;
126
161
  `{type, integration, account?, status, message}`.
127
162
  - `budget-exhausted` — hit the configured `max_turns` /
128
163
  `max_budget_usd` for `routine.fetch_window`.
@@ -0,0 +1,19 @@
1
+ # Wiki Agent
2
+
3
+ You maintain the operator's internal wiki workspace.
4
+
5
+ ## Principles
6
+
7
+ - **Bash invocations that hit the daemon API MUST start with the literal `curl` token.** The session's allow-list is `Bash(curl *)`, prefix-matched under `dontAsk`. Anything starting with `echo`, `cat`, `bash`, `(`, a variable assignment, or chaining two curls with `;` / `&&` / `|` is silently denied — no error, no body, the call simply does not run. For multi-KB bodies use a heredoc redirected into curl on the same line: `curl ... -d @- <<'JSON' … JSON` — the command still starts with `curl`, and the shim reads stdin via `-d @-`. See `wiki-vault-rules` for the canonical shapes.
8
+ - Treat the wiki vault as durable user data. Preserve source fidelity and make uncertainty visible.
9
+ - Write only through the daemon Wiki API (`/api/wiki/{{workspace_name}}/files/...`). The `Write` and `Edit` tools are stripped from this session's allow-list and are silently denied under `dontAsk`; do not try to "make them work" via path rewriting. `Bash(find ...)`, `Bash(ls ...)`, `Bash(cat ...)` and other shell utilities are also denied — only `Bash(curl *)` and `Bash(jq *)` are on the allow-list, so enumerate the vault via `GET /api/wiki/{{workspace_name}}/index`, not from disk. A file appears in the vault only after the daemon returns `{"ok":true,"path":"<path>"}` to your POST/PATCH.
10
+ - Follow the layer contract from the loaded wiki skills. If an API write is rejected, fix the target path or payload; do not bypass the route.
11
+ - **Do not invent daemon endpoints.** The complete write surface is what `wiki-vault-rules` lists. Routes like `/api/send-message`, `/api/whatsapp/send`, `/api/notify-user`, `/api/dm` do not exist; calls there return 401/404 and do nothing. Your completion DM is your final assistant TEXT message — the daemon forwards it automatically.
12
+ - **Never claim a write happened without the daemon's 200 receipt.** A successful POST returns JSON containing `"ok":true` and the canonical `"path"`; the success DM must cite that exact path byte-for-byte. If the response is anything else, the write failed — emit the failure DM.
13
+ - Output language for durable prose is `{{language}}` unless source fidelity requires preserving quoted source text.
14
+
15
+ ## Workspace
16
+
17
+ - Workspace: `{{workspace_name}}`
18
+ - Vault path: `{{vault_path}}`
19
+ - Schema version: `{{schema_version}}`
@@ -0,0 +1,161 @@
1
+ ---
2
+ schema_version: 1
3
+ slug: features/messaging/bang-commands
4
+ title: Bang Commands
5
+ id: bang-commands
6
+ aliases:
7
+ - "!stop"
8
+ - "!start"
9
+ - "!cost"
10
+ - "!report"
11
+ - "!help"
12
+ - exclamation commands
13
+ - chat commands
14
+ category: features
15
+ summary: |
16
+ Short owner-only commands typed in any paired DM (Slack, Telegram,
17
+ Discord, WhatsApp, dashboard chat) that the daemon answers directly,
18
+ with no agent backend involved and no cost. Use them to pause /
19
+ resume, check spend, see recent failures, and list every command.
20
+ section: messaging
21
+ tags:
22
+ - core
23
+ - messaging
24
+ - operations
25
+ status: stable
26
+ ask_examples:
27
+ - How do I pause the agent from my phone?
28
+ - What can I type in the DM to control Aitne?
29
+ - How do I list all the commands?
30
+ - Where do I see how much the agent spent this week?
31
+ locale: en-US
32
+ created: 2026-05-12
33
+ updated: 2026-05-12
34
+ keywords:
35
+ - bang command
36
+ - "!stop"
37
+ - "!start"
38
+ - "!cost"
39
+ - "!report"
40
+ - "!help"
41
+ - pause
42
+ - resume
43
+ related:
44
+ - features/messaging/overview
45
+ - features/messaging/pairing-and-magic-phrase
46
+ - guides/pause-the-agent
47
+ - features/operations/cost-tracking
48
+ ui_anchors:
49
+ - /settings/commands
50
+ ---
51
+
52
+ # Bang Commands
53
+
54
+ ## In One Sentence
55
+
56
+ DM the agent a short word starting with `!` and the daemon answers
57
+ directly — no LLM call, no cost, no session opened.
58
+
59
+ ## Who Can Use Them
60
+
61
+ Only the **paired owner channel**. A bang from any other sender is
62
+ dropped by the same single-owner filter that drops every other DM.
63
+ Pair your messaging app first; see
64
+ [Pairing & Magic Phrase](pairing-and-magic-phrase.md).
65
+
66
+ ## Available Commands
67
+
68
+ | Command | What it does |
69
+ |---|---|
70
+ | `!help` | Lists every command currently registered — built-ins plus any custom user commands. |
71
+ | `!stop` | Pauses cron-driven autonomous work (hourly check, morning / evening / weekly / monthly routines, scheduled tasks). In-flight runs are **not** aborted. |
72
+ | `!start` | Resumes autonomous work after `!stop`. |
73
+ | `!cost` | Last-7-day spend across all backends. |
74
+ | `!cost claude` / `!cost codex` / `!cost gemini` | Spend for a single backend. |
75
+ | `!report` | Recent agent failures (last 7 days, top groups, most recent sample). |
76
+
77
+ Custom commands added at `/settings/commands` show up in `!help`
78
+ automatically — no restart needed.
79
+
80
+ ## How They Look
81
+
82
+ Every reply leads with a `[SYSTEM · <command>]` marker so you can tell
83
+ at a glance it came from the daemon, not the agent:
84
+
85
+ ```
86
+ [SYSTEM · !cost · last 7d]
87
+ Total: $1.42 (37 sessions)
88
+
89
+ - claude: $1.10 (29 sessions)
90
+ - codex: $0.32 ( 8 sessions)
91
+ - gemini: $0.00 ( 0 sessions)
92
+ ```
93
+
94
+ `!help` lists each entry with the name on its own line and the
95
+ description indented:
96
+
97
+ ```
98
+ [SYSTEM · !help]
99
+
100
+ Built-in:
101
+
102
+ !cost
103
+ Show last-7-day Claude / Codex / Gemini spend.
104
+
105
+ !help
106
+ Show every registered command.
107
+
108
+ !report
109
+ Show recent agent failures.
110
+
111
+ !start
112
+ Resume autonomous work after !stop.
113
+
114
+ !stop
115
+ Pause cron-driven autonomous work. In-flight runs are not aborted.
116
+ ```
117
+
118
+ The `Custom:` section appears below the built-ins when you have
119
+ enabled user commands at `/settings/commands`.
120
+
121
+ ## How They Behave
122
+
123
+ - **Exact match.** `!stop`, `!cost`, `!cost claude` are recognised;
124
+ `!stop now please` is not — it falls through to the agent path.
125
+ - **DM only.** Bangs typed into a shared channel are ignored.
126
+ - **No cost.** No LLM is invoked; no `conversation_sessions` row is
127
+ opened. Every invocation writes one `bang_command` row to
128
+ `agent_actions` for the activity log.
129
+ - **While paused**, any DM (bang or not) replies with the paused
130
+ notice; only `!start`, `!cost`, `!report`, and `!help` continue to
131
+ run.
132
+ - **Replies land where the command did** — same platform, same
133
+ channel, same thread.
134
+
135
+ ## Pause vs. `aitne stop`
136
+
137
+ `!stop` pauses **autonomous** work; the daemon stays up so it can
138
+ receive `!start`. It is the right tool for "be quiet for a bit".
139
+
140
+ `aitne stop` (CLI) shuts the daemon down entirely. Use it when you
141
+ want everything off, including the message receivers. See
142
+ [Pause the Agent](../../guides/pause-the-agent.md) for the longer-
143
+ window version.
144
+
145
+ ## When Something Goes Wrong
146
+
147
+ - **No reply at all.** The DM is probably hitting an unpaired channel
148
+ — pair first. See [Messaging Overview](overview.md).
149
+ - **The reply lists fewer commands than you expect.** `!help` only
150
+ lists *enabled* user commands. Toggle the row on at
151
+ `/settings/commands`.
152
+ - **`!cost foo` says "unknown command".** Only `claude`, `codex`,
153
+ `gemini` are valid backend arguments today. Plain `!cost` (no
154
+ argument) covers all three.
155
+
156
+ ## Related
157
+
158
+ - [Messaging Overview](overview.md)
159
+ - [Pairing & Magic Phrase](pairing-and-magic-phrase.md)
160
+ - [Pause the Agent](../../guides/pause-the-agent.md)
161
+ - [Cost Tracking](../operations/cost-tracking.md)
@@ -44,6 +44,7 @@ related:
44
44
  - features/messaging/whatsapp
45
45
  - features/messaging/dashboard-chat
46
46
  - features/messaging/voice-attachments
47
+ - features/messaging/bang-commands
47
48
  - features/operations/notifications
48
49
  - features/operations/quiet-hours
49
50
  ui_anchors:
@@ -114,6 +115,8 @@ adapter and the dispatcher both check).
114
115
  ## Related
115
116
 
116
117
  - [Pairing & Magic Phrase](pairing-and-magic-phrase.md)
118
+ - [Bang Commands](bang-commands.md) — `!stop` / `!start` / `!cost` /
119
+ `!report` / `!help` for mobile-first daemon control.
117
120
  - [Voice Attachments](voice-attachments.md) — local Whisper
118
121
  transcription for inbound audio.
119
122
  - [Dashboard Chat](dashboard-chat.md) — the in-browser equivalent.
@@ -0,0 +1,222 @@
1
+ ---
2
+ schema_version: 1
3
+ slug: features/wiki/commands
4
+ title: Wiki Commands
5
+ id: wiki-commands
6
+ aliases:
7
+ - "!ingest"
8
+ - "!compile"
9
+ - "!ask"
10
+ - "!wiki"
11
+ - "!lint"
12
+ - "!trace"
13
+ - "!connect"
14
+ - bang commands wiki
15
+ category: features
16
+ summary: |
17
+ Reference for the wiki bang commands — `!ingest`, `!compile`,
18
+ `!compile full`, `!ask`, `!wiki`, plus the Phase 3 operational
19
+ triad `!lint`, `!trace`, `!connect` — including the dispatch-mode
20
+ and approval-gate semantics.
21
+ section: wiki
22
+ tags:
23
+ - wiki
24
+ - bang-commands
25
+ status: stable
26
+ ask_examples:
27
+ - How do I send a URL to the wiki?
28
+ - What is the difference between `!compile` and `!compile full`?
29
+ - Why did `!compile full` ask for approval?
30
+ - What does serial dispatch mode change?
31
+ - How do I run a wiki health check?
32
+ - What does `!trace` do?
33
+ - How do I bridge two domains with `!connect`?
34
+ locale: en-US
35
+ created: 2026-05-12
36
+ updated: 2026-05-12
37
+ related:
38
+ - features/wiki/overview
39
+ - features/messaging/bang-commands
40
+ - guides/budget-and-cost-for-wiki
41
+ - guides/maintain-wiki-health
42
+ - guides/explore-with-trace-and-connect
43
+ - troubleshooting/wiki-ingest-full-blocked
44
+ ui_anchors:
45
+ - /wiki
46
+ - /wiki/timeline
47
+ - /settings/wiki
48
+ - /approvals
49
+ ---
50
+
51
+ # Wiki Commands
52
+
53
+ Use these from a paired DM channel after enabling the wiki — open
54
+ **Setup → Settings → Wiki** to enable, then browse from **My Life →
55
+ Wiki**.
56
+
57
+ | Command | Effect |
58
+ |---|---|
59
+ | `!ingest [@<workspace>] <url> [url...]` | Queues one `wiki.ingest_url` event per URL. |
60
+ | `!compile [@<workspace>]` | Queues an incremental `wiki.compile` run. |
61
+ | `!compile [@<workspace>] --preview` | Dry-run preview: lists pages that would be added / modified / unchanged plus cost and ETA. Aliases: `--dry-run`. No agent session runs. |
62
+ | `!compile [@<workspace>] full` | Queues a full rebuild. Cost-gated; estimates above the threshold need dashboard approval first. |
63
+ | `!compile [@<workspace>] full --preview` | Dry-run preview of the full rebuild. Same shape as the incremental preview. |
64
+ | `!ask [@<workspace>] <question>` | Queues a `wiki.ask` answer run and writes to `30_outputs/`. |
65
+ | `!lint [@<workspace>]` | Audits the wiki for orphans, broken links, schema drift, taxonomy candidates, and stale notes. Writes `90_meta/health/<YYYY-MM-DD>.md`. |
66
+ | `!trace [@<workspace>] <topic>` | Reconstructs how an idea has evolved across raw / wiki / outputs. Writes `30_outputs/<YYYY-MM-DD>-trace-<slug>.md`. |
67
+ | `!connect [@<workspace>] <a> <b>` | Finds bridges (shared terms, references, structural analogies) between two domains. Writes `30_outputs/<YYYY-MM-DD>-connect-<slug-a>--<slug-b>.md`. |
68
+ | `!wiki` | Shows workspace status and counts. One line per workspace when multiple are active. |
69
+ | `!wiki help` | Shows the command list. |
70
+
71
+ `!ingest` accepts only `http://` and `https://` URLs and caps each
72
+ batch at 10 URLs.
73
+
74
+ ## `@<workspace>` — addressing a non-default workspace
75
+
76
+ If you run more than one wiki workspace (Phase 5), every bang command
77
+ accepts an optional `@<name>` token immediately after the bang. The
78
+ token is parsed before the command's own argument parser sees the
79
+ rest, so multi-word topics and comma-separated arguments work as
80
+ normal:
81
+
82
+ !compile @research full
83
+ !ask @parenting what did the pediatrician recommend?
84
+ !connect @research diffusion models, score matching
85
+
86
+ Omit the token and the command targets the **default** workspace.
87
+ See `agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md`
88
+ for a walkthrough.
89
+
90
+ ## `!compile --preview` — the dry run
91
+
92
+ Use `!compile --preview` (or `--dry-run`) when you want to see what
93
+ `!compile` would do without spending tokens:
94
+
95
+ - **added** — wiki pages that would be created (raws with no
96
+ existing wiki match).
97
+ - **modified** — wiki pages that would be rewritten (raws whose
98
+ slug matches an existing wiki page).
99
+ - **unchanged** — wiki pages the compile is expected to skip.
100
+ - **est. cost** — Optimistic / pessimistic bracket plus expected
101
+ spend.
102
+ - **est. duration** — Rough wall-clock estimate (intentionally
103
+ pessimistic).
104
+
105
+ The preview is an upper bound. The compile is an LLM and may
106
+ merge or skip pages inside the agent loop; the preview cannot
107
+ predict that exactly, but it will not undercount the touch set.
108
+ Reply `!compile` (or `!compile full`) to actually run the compile.
109
+
110
+ ## Dispatch Mode for `!ingest`
111
+
112
+ `!ingest` honours the per-workspace **dispatch mode** in
113
+ Settings → Wiki:
114
+
115
+ - **Parallel** (default): all URLs fan out simultaneously up to the
116
+ per-URL concurrency cap. Fastest; small risk of bursting rate
117
+ limits at the URL host.
118
+ - **Serial**: URLs are enqueued in submitted order; each agent
119
+ session starts only after the previous one completes. Slower but
120
+ predictable budget and rate.
121
+
122
+ The acknowledgement DM tells you which mode ran
123
+ (`in parallel` / `serially`).
124
+
125
+ ## `!compile full` — the Cost Gate
126
+
127
+ Full rebuilds touch every wiki note and are the most expensive
128
+ command in the wiki surface. The flow:
129
+
130
+ 1. The bang handler estimates the cost (raw count × assumed input
131
+ tokens × Sonnet unit cost, bracketed at 0.5× / 1× / 2×).
132
+ 2. On an external git-tracked vault with **Auto-commit before
133
+ `!compile full`** enabled and a clean working tree, Aitne runs
134
+ `git add -A && git commit -m "aitne wiki: pre-compile snapshot <ts>"`
135
+ before continuing. A dirty tree refuses the operation — commit or
136
+ stash first.
137
+ 3. If the pessimistic estimate exceeds your per-workspace approval
138
+ threshold (default $2.00), the run is queued under **Approvals**
139
+ in the dashboard. Approve from `/approvals` to start the compile.
140
+ 4. Otherwise, the run starts autonomously and you receive a
141
+ completion DM with actual spend.
142
+
143
+ The same estimate is shown live in **Settings → Wiki** so you can
144
+ see what the next `!compile full` will cost before you run it.
145
+
146
+ ## Operational Triad — `!lint`, `!trace`, `!connect`
147
+
148
+ These three commands round out the wiki surface for ongoing
149
+ maintenance and exploration. None of them write to the content
150
+ layers (`10_raw/`, `20_wiki/`); they only produce health reports
151
+ (`90_meta/health/`) or output documents (`30_outputs/`).
152
+
153
+ ### `!lint`
154
+
155
+ Run periodically (weekly is a sensible cadence) to audit the wiki
156
+ for:
157
+
158
+ - Orphaned wiki notes (no incoming links).
159
+ - Broken `[[wikilinks]]` pointing at missing files.
160
+ - Notes that violate the schema declared in
161
+ `90_meta/schemas/{raw,wiki,output}.md`.
162
+ - Stale wiki notes whose newest source is more than 90 days old.
163
+ - Slug/title variants that look like the same concept.
164
+ - Recurring concepts that should be promoted into `90_meta/taxonomy.md`.
165
+ - Drift between `20_wiki/_index.md` and the files on disk.
166
+
167
+ The output is one Markdown report at
168
+ `90_meta/health/<YYYY-MM-DD>.md` with a `## Summary` line, a
169
+ `## Action items` list, and one section per check. When taxonomy
170
+ candidates are found, `!lint` also appends a `# Candidates` section
171
+ to `90_meta/taxonomy.md` for your review — it never promotes the
172
+ candidates itself; you decide which to keep.
173
+
174
+ The latest report is rendered prominently on **My Life → Wiki →
175
+ Timeline & health** (`/wiki/timeline`).
176
+
177
+ ### `!trace <topic>`
178
+
179
+ Reconstructs the chronological evolution of an idea across every
180
+ wiki layer. Use a free-form topic — the skill canonicalises against
181
+ `90_meta/taxonomy.md` before deriving the output slug:
182
+
183
+ ```
184
+ !trace quantum computing
185
+ !trace formal methods in distributed systems
186
+ ```
187
+
188
+ The output is a timeline at
189
+ `30_outputs/<YYYY-MM-DD>-trace-<slug>.md` grouped into two to five
190
+ phases with cited evidence and an explicit gap list. If the wiki
191
+ has fewer than two sources on the topic, the report says so
192
+ directly — no speculative filler.
193
+
194
+ ### `!connect <a> <b>`
195
+
196
+ Bridges two domains by surfacing shared terminology, common
197
+ references, structural analogies, and proposed bridging concepts.
198
+ Pass exactly two topics separated by whitespace or by a comma; the
199
+ comma form supports multi-word topics:
200
+
201
+ ```
202
+ !connect quantum gravity
203
+ !connect quantum computing, classical computing
204
+ ```
205
+
206
+ A single argument, three or more arguments, an empty input, or a
207
+ trailing comma all return a usage message — pick a topic for each
208
+ side. The output lands at
209
+ `30_outputs/<YYYY-MM-DD>-connect-<slug-a>--<slug-b>.md`. When no
210
+ genuine bridges exist, the report still writes — a "no connection"
211
+ finding is itself useful.
212
+
213
+ ## Disabled-State Behaviour
214
+
215
+ When no active wiki workspace exists, every `wiki.*`-routed bang
216
+ command (`!ingest`, `!compile`, `!ask`, `!lint`, `!trace`, `!connect`)
217
+ replies with:
218
+
219
+ > Wiki is not enabled. Open `/settings/wiki` to enable.
220
+
221
+ `!wiki help` is exempt — it returns the command list regardless of
222
+ enablement so you can discover the surface before opting in.