@aitne-sh/aitne 0.1.4 → 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 (87) hide show
  1. package/README.md +16 -0
  2. package/agent-assets/agent-profiles/_safety.md +29 -0
  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 +123 -15
  38. package/agent-assets/skills/roadmap/SKILL.md +31 -4
  39. package/agent-assets/skills/schedule/SKILL.md +44 -3
  40. package/agent-assets/skills/today/SKILL.md +50 -11
  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/routine.roadmap_refresh.md +7 -3
  67. package/agent-assets/task-flows/scheduled.dm.md +477 -0
  68. package/agent-assets/task-flows/setup.initial.md +50 -23
  69. package/agent-assets/task-flows/wiki.ask.md +11 -0
  70. package/agent-assets/task-flows/wiki.compile.md +28 -0
  71. package/agent-assets/task-flows/wiki.connect.md +12 -0
  72. package/agent-assets/task-flows/wiki.ingest_url.md +35 -0
  73. package/agent-assets/task-flows/wiki.lint.md +13 -0
  74. package/agent-assets/task-flows/wiki.trace.md +13 -0
  75. package/agent-assets/wiki-seeds/schemas/output.md +12 -0
  76. package/agent-assets/wiki-seeds/schemas/raw.md +13 -0
  77. package/agent-assets/wiki-seeds/schemas/wiki.md +12 -0
  78. package/agent-assets/wiki-seeds/taxonomy.md +13 -0
  79. package/package.json +10 -6
  80. package/scripts/check-redaction-coverage.mjs +0 -109
  81. package/scripts/commands.md +0 -0
  82. package/scripts/message-discipline-digest.mjs +0 -535
  83. package/scripts/poc/google-connector-inheritance/REPORT.md +0 -197
  84. package/scripts/poc/google-connector-inheritance/claude-sdk-probe.mjs +0 -79
  85. package/scripts/regen-skill-fixtures.mjs +0 -39
  86. package/scripts/remint-roadmap-ids.mjs +0 -257
  87. package/scripts/smoke-obsidian-api.mjs +0 -166
@@ -2,12 +2,17 @@
2
2
 
3
3
  ## Routine Data-Fetch Pre-Pass
4
4
 
5
- You are the **pre-pass fetcher** dispatched by the daemon immediately
6
- ahead of a parent routine session. Your sole job is to materialise the
7
- `<fetch>` rows from the `<acquisition-plan>` block in your prompt into
8
- fresh `/api/observations` rows. The parent routine reads those rows
9
- after you terminate; you do not write to context files, do not
10
- synthesize, and do not notify the owner.
5
+ You are the **pre-pass fetcher** dispatched by the daemon's fan-out
6
+ coordinator immediately ahead of a parent routine session. **This
7
+ sub-session is scoped to a single integration** every `<fetch>` row
8
+ in the `<acquisition-plan>` block below shares the same `integration`
9
+ attribute, and the sole partial inlined below owns the only
10
+ `(integration, mode)` cell you can hit. Your job is to materialise
11
+ those `<fetch>` rows into fresh `/api/observations` rows via
12
+ `POST /api/observations/batch` — one batched array per acquired window,
13
+ not one curl per item. The coordinator merges your single JSON-line
14
+ output with the other integrations' sub-sessions; you do not write to
15
+ context files, do not synthesize, and do not notify the owner.
11
16
 
12
17
  Read the `<acquisition-plan>` block carefully — every row carries the
13
18
  exact `(integration, mode, window, account?, query)` tuple the daemon
@@ -17,36 +22,28 @@ registries, do **not** guess tool names, do **not** call the daemon's
17
22
  integration (`outlook_mail`, `outlook_calendar` today). If a row has
18
23
  no usable surface, append a `no-surface` error entry and move on.
19
24
 
20
- For every `<fetch>` row, follow the matching integration partial
21
- below. Each partial owns the wire surface for its `(integration, mode)`
22
- cell`applyIntegrationModeFilter` has already pruned the inactive
23
- branches, so the body you see is the one that applies for the current
24
- deployment state.
25
+ The partial body below is the source of truth for argument names and
26
+ endpoint shapes. **Do not transfer argument names across integration
27
+ boundaries**your prompt contains exactly one integration's partial
28
+ on purpose. If the partial says the upstream parameter is named
29
+ `maxResults`, do not pass `limit` because another API uses that name.
25
30
 
26
31
  ### Step 1 — Fetch every row in `<acquisition-plan>`
27
32
 
28
- For each `<fetch integration="…" mode="…" window="…" query="…" account="…?">` element:
29
-
30
- - `integration="gmail"` → follow the gmail mail partial below.
31
- - `integration="outlook_mail"` follow the outlook_mail mail partial below.
32
- - `integration="google_calendar"` follow the google_calendar partial below.
33
- - `integration="outlook_calendar"` follow the outlook_calendar partial below.
34
- - `integration="notion"` follow the notion partial below.
33
+ Every `<fetch integration="…" mode="…" window="…" query="…" [account=""]>`
34
+ row in `<acquisition-plan>` is for the integration covered by the
35
+ partial below the coordinator already partitioned by
36
+ `integrationKey` before dispatching you. Follow the integration
37
+ partial. The `account` attribute is present only in `direct` mode —
38
+ see the partial body for the `"default"` fallback used by
39
+ `delegated-same` / `delegated-cross` / `native`.
35
40
 
36
41
  If `<acquisition-plan>` carries no `<fetch>` rows (an empty plan is
37
42
  legal — every routine has at least the wrapper) print the
38
43
  `{"fetched":0,"posted":0,"duplicates":0,"errors":[]}` JSON line and
39
44
  terminate.
40
45
 
41
- {include:_partials/mail-acquire.gmail.md}
42
-
43
- {include:_partials/mail-acquire.outlook_mail.md}
44
-
45
- {include:_partials/calendar-acquire.google_calendar.md}
46
-
47
- {include:_partials/calendar-acquire.outlook_calendar.md}
48
-
49
- {include:_partials/notion-acquire.notion.md}
46
+ {integration_partial}
50
47
 
51
48
  ### Step 2 — Emit a single JSON line and terminate
52
49
 
@@ -58,8 +55,11 @@ error), emit exactly one JSON line on stdout with the shape:
58
55
  ```
59
56
 
60
57
  - `fetched` — total items returned by upstream APIs across every row.
61
- - `posted` — count of 2xx responses from `/api/observations` (new rows).
62
- - `duplicates` count of 409 responses (server-side dedup-hash collision).
58
+ - `posted` — sum of the batch endpoint's envelope-level `posted`
59
+ counter across every `POST /api/observations/batch` call you make
60
+ (i.e. `results[*].status ∈ {"created","modified"}`).
61
+ - `duplicates` — sum of the batch endpoint's envelope-level `duplicates`
62
+ counter (i.e. `results[*].status == "duplicate"`).
63
63
  - `errors` — list of `{type, ...}` records. Common types:
64
64
  - `no-surface` — the row points at an in-session connector that
65
65
  isn't bound on this backend.
@@ -67,6 +67,14 @@ error), emit exactly one JSON line on stdout with the shape:
67
67
  filter (defensive).
68
68
  - `fetch-failed` — upstream API returned a non-2xx; include
69
69
  `{type, integration, account?, status, message}`.
70
+ - `flip-locked` — `POST /api/observations/batch` returned
71
+ `results[*].status="flip_locked"` for an integration mid-flip.
72
+ Include `{type, integration, account?}`. Do NOT retry inline —
73
+ the next routine tick reaps it.
74
+ - `validation-error` — `POST /api/observations/batch` returned
75
+ `results[*].status="validation_error"` for a malformed item.
76
+ Include `{type, integration, ref, detail}` (copy `detail` from
77
+ `results[*].error`).
70
78
  - `budget-exhausted` — you hit the configured `max_turns` /
71
79
  `max_budget_usd` for `routine.fetch_window`. Include
72
80
  `{type, remaining: <fetch-row-summary>}` so the audit trail
@@ -74,9 +82,9 @@ error), emit exactly one JSON line on stdout with the shape:
74
82
 
75
83
  Do NOT print prose around the JSON line — the dispatcher reads the
76
84
  last JSON-shaped object on stdout. A malformed line surfaces as a
77
- `pre-pass-failed` error in the parent routine's `<fetch_report>`
78
- block and the parent continues with whatever observations the rest of
79
- the plan produced.
85
+ `pre-pass-failed` error in the coordinator's `<fetch_report>` block
86
+ and the parent routine continues with whatever observations the rest
87
+ of the plan produced.
80
88
 
81
89
  ### Hard guardrails
82
90
 
@@ -86,8 +94,15 @@ the plan produced.
86
94
  by contract.
87
95
  - Do NOT spawn sub-agents (Task tool or otherwise). Keep the run flat
88
96
  so the dispatcher can clamp turn / budget cleanly.
89
- - `actor` on every `/api/observations` POST MUST be `"agent"` — the
90
- server rejects `"user"`.
97
+ - `actor` on every element of the `observations[]` array MUST be
98
+ `"agent"` — the server rejects `"user"`.
91
99
  - Do NOT compute a `contentHash` yourself; the server derives it from
92
- `(source, payload)`. A 409 means dedup count it in `duplicates`
93
- and continue.
100
+ `(source, payload)` per item. A `results[*].status == "duplicate"`
101
+ means dedup — count it in `duplicates` and continue.
102
+ - Do NOT write a shell script to `/tmp/` and pipe it to bash. Do NOT
103
+ loop over items in a shell `for`. Do NOT chain multiple curl
104
+ invocations. Those shapes are blocked by the daemon's Bash hooks
105
+ (one curl per Bash call, heredoc bodies are stripped from URL
106
+ validation). One window → one curl → one JSON body whose
107
+ `observations[]` array carries every fetched item (up to 200; split
108
+ larger windows into multiple POSTs).
@@ -41,9 +41,12 @@ Global rules (apply at every step):
41
41
  > routine prepares the agent-day in progress — never tomorrow.
42
42
 
43
43
  ### Step 2 — Sync external sources (apply the day-type filter at read time)
44
- 3. Mail and Notion acquisition. The pre-pass fetcher session
44
+ 3. Mail, Calendar, and Notion acquisition. The pre-pass fetcher session
45
45
  (`routine.fetch_window`) ran ahead of you and posted a `<fetch>` row's
46
- worth of observations for every active mail / notion integration. The
46
+ worth of observations for every active mail / calendar / notion
47
+ integration. Calendar windows are pre-fetched ONLY for non-direct
48
+ modes (delegated / native); direct-mode calendar data is still
49
+ inlined into `<calendar_events_7d>` by ContextBuilder. The
47
50
  `<fetch_report>` block injected ahead of this body tells you the
48
51
  pre-pass status:
49
52
 
@@ -75,7 +78,13 @@ Global rules (apply at every step):
75
78
 
76
79
  c. **Calendar context** is already injected as `<calendar_events_7d>`
77
80
  (multi-provider) ahead of this prompt — reference the block
78
- directly in Step 6 (today.md generation).
81
+ directly in Step 6 (today.md generation). Mode-aware shape:
82
+ direct providers carry inline events; non-direct providers
83
+ (delegated / native) carry a hint pointing at
84
+ `/api/observations?source_prefix=google_calendar:,outlook_calendar:`
85
+ because the pre-pass already POSTed events there. Read the
86
+ observations table verbatim for non-direct providers — do NOT
87
+ re-drive the connector yourself.
79
88
 
80
89
  Skip the entire step when no integrations are active and no mail /
81
90
  notion observations are pending.
@@ -115,7 +115,28 @@ Journal synthesis is deferred to the next morning run. The first
115
115
  - ## Agent Log ← initialize with
116
116
  `- HH:MM Morning Routine (initial) completed (day-type: …)`.
117
117
  - ## Handoff ← `- (none)` (no carry-over data available).
118
- 8. Update `roadmap.md` only if a milestone completed or shifted.
118
+ 8. **Populate `roadmap.md` inline (initial-day variant).** On the very first
119
+ morning routine the setup wizard's skeleton roadmap is still in place
120
+ (the `## Annual Goals`, `## Quarterly Focus`, and `## Agent Action Plan`
121
+ sections all contain the placeholder line `_(Not yet configured)_`).
122
+ When *any* of those placeholders is still present, run a full populate
123
+ per the `roadmap` skill — same forward-90-day scope as
124
+ `routine.roadmap_refresh` (Annual Goals from the management rules,
125
+ Quarterly Focus from active projects + `<calendar_events_7d>`,
126
+ Preparation Timeline from `travel_bookings` + dated calendar items,
127
+ Agent Action Plan seeded from User Tasks + roadmap-relevant
128
+ `agent_schedule` rows). Acquire the cross-request write lock via the
129
+ skill before any `PUT /api/context/roadmap` — the daemon enforces it
130
+ and a missing lock returns 423. If every placeholder has already been
131
+ replaced (rare: a previous initial run completed Step 6.8 then today.md
132
+ failed, or a manual edit landed), fall back to the regular
133
+ morning-routine semantics: spot-update only if a milestone completed
134
+ or shifted. Skipping this step leaves roadmap.md as the skeleton — the
135
+ daemon's `isRoadmapStale()` post-hook then schedules a separate
136
+ `routine.roadmap_refresh` to make it good, but the user will see a
137
+ blank-looking roadmap until that second session lands. Doing it inline
138
+ here is one Sonnet/Opus turn instead of two and removes ~1–2 minutes
139
+ of post-setup latency.
119
140
 
120
141
  ### Step 7 — Register schedule
121
142
  9. Register every `## Agent Plan` row via `POST /api/schedule`.
@@ -176,11 +176,15 @@ coordinates the high-level gather → analyze → write loop.
176
176
  consult that ID before emitting a new entry or matching by text.
177
177
 
178
178
  7. Consume the observations whose candidate was incorporated or
179
- deliberately dropped always pass the event correlation id:
180
- ```
179
+ deliberately dropped. Copy the `correlationId` value verbatim from
180
+ the `<event_correlation_id>…</event_correlation_id>` tag in your
181
+ turn context — do not paste the placeholder. Bulk-only; the per-id
182
+ form does not exist. Field contract is in the `observations`
183
+ skill ("POST /api/observations/consume").
184
+ ```bash
181
185
  curl -s -X POST http://localhost:8321/api/observations/consume \
182
186
  -H 'Content-Type: application/json' \
183
- -d '{"ids":[<id>, ...], "correlationId": "<event_correlation_id>"}'
187
+ -d '{"ids":[<id>, ...],"correlationId":"<copied-from-event_correlation_id-tag>"}'
184
188
  ```
185
189
  Observations left pending here will re-appear on the next refresh.
186
190