@aitne-sh/aitne 0.1.3 → 0.1.4

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 +151 -147
  2. package/agent-assets/agent-profiles/conversational.md +23 -1
  3. package/agent-assets/agent-profiles/observer.md +15 -0
  4. package/agent-assets/agent-profiles/routine-fetch-window.md +128 -0
  5. package/agent-assets/agent-profiles/routine.md +16 -0
  6. package/agent-assets/agent-profiles/task.md +15 -0
  7. package/agent-assets/docs/concepts/auth-health.md +25 -9
  8. package/agent-assets/docs/concepts/backends-and-tiers.md +40 -4
  9. package/agent-assets/docs/concepts/costs-and-quotas.md +87 -25
  10. package/agent-assets/docs/concepts/delegated-mode.md +7 -13
  11. package/agent-assets/docs/concepts/memory-model.md +14 -1
  12. package/agent-assets/docs/concepts/observations.md +19 -1
  13. package/agent-assets/docs/concepts/process-keys.md +5 -0
  14. package/agent-assets/docs/concepts/routines.md +22 -10
  15. package/agent-assets/docs/concepts/safety-model.md +3 -8
  16. package/agent-assets/docs/concepts/skills.md +36 -1
  17. package/agent-assets/docs/features/integrations/calendar.md +74 -3
  18. package/agent-assets/docs/features/integrations/git.md +4 -4
  19. package/agent-assets/docs/features/integrations/github.md +75 -107
  20. package/agent-assets/docs/features/lifestyle/git.md +169 -22
  21. package/agent-assets/docs/features/messaging/overview.md +10 -1
  22. package/agent-assets/docs/features/routines/morning-routine.md +1 -1
  23. package/agent-assets/docs/getting-started/01-what-is-this.md +30 -12
  24. package/agent-assets/docs/getting-started/02-first-steps.md +15 -4
  25. package/agent-assets/docs/getting-started/03-what-can-this-do.md +17 -2
  26. package/agent-assets/docs/guides/install-and-run.md +10 -1
  27. package/agent-assets/docs/guides/setup-wizard.md +43 -6
  28. package/agent-assets/docs/guides/switch-default-backend.md +7 -3
  29. package/agent-assets/docs/reference/skills.md +10 -1
  30. package/agent-assets/docs/troubleshooting/auth-failed.md +27 -8
  31. package/agent-assets/docs/troubleshooting/quota-exhausted.md +35 -12
  32. package/agent-assets/skills/context/SKILL.md +6 -0
  33. package/agent-assets/skills/external-services/SKILL.md +4 -0
  34. package/agent-assets/skills/external-services/SKILL.native.claude.md +320 -0
  35. package/agent-assets/skills/external-services/SKILL.native.codex.md +243 -0
  36. package/agent-assets/skills/external-services/SKILL.native.gemini.md +237 -0
  37. package/agent-assets/skills/mail/SKILL.md +42 -14
  38. package/agent-assets/skills/mail/SKILL.native.claude.md +175 -0
  39. package/agent-assets/skills/mail/SKILL.native.codex.md +165 -0
  40. package/agent-assets/skills/mail/SKILL.native.gemini.md +169 -0
  41. package/agent-assets/skills/management-task-modify/SKILL.md +2 -1
  42. package/agent-assets/skills/management-task-stop/SKILL.md +2 -2
  43. package/agent-assets/skills/notify/SKILL.md +4 -4
  44. package/agent-assets/skills/notion/SKILL.md +6 -0
  45. package/agent-assets/skills/notion/SKILL.native.claude.md +202 -0
  46. package/agent-assets/skills/notion/SKILL.native.codex.md +166 -0
  47. package/agent-assets/skills/notion/SKILL.native.gemini.md +167 -0
  48. package/agent-assets/skills/observations/SKILL.md +7 -0
  49. package/agent-assets/skills/project-doc/SKILL.md +6 -0
  50. package/agent-assets/skills/reading/SKILL.md +2 -0
  51. package/agent-assets/skills/roadmap/SKILL.md +7 -0
  52. package/agent-assets/skills/today/SKILL.md +7 -0
  53. package/agent-assets/skills/user-interview/SKILL.md +1 -1
  54. package/agent-assets/skills/user-profile/SKILL.md +7 -0
  55. package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +119 -0
  56. package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +101 -0
  57. package/agent-assets/task-flows/_partials/mail-acquire.gmail.md +113 -0
  58. package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +97 -0
  59. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +104 -0
  60. package/agent-assets/task-flows/git.project.refresh_architecture.md +24 -1
  61. package/agent-assets/task-flows/message.received.dm.md +3 -0
  62. package/agent-assets/task-flows/message.received.dm.native.claude.md +76 -0
  63. package/agent-assets/task-flows/message.received.dm.native.codex.md +57 -0
  64. package/agent-assets/task-flows/message.received.dm.native.gemini.md +70 -0
  65. package/agent-assets/task-flows/message.received.dm_first.md +3 -0
  66. package/agent-assets/task-flows/message.received.dm_first.native.claude.md +56 -0
  67. package/agent-assets/task-flows/message.received.dm_first.native.codex.md +48 -0
  68. package/agent-assets/task-flows/message.received.dm_first.native.gemini.md +54 -0
  69. package/agent-assets/task-flows/routine.evening_review.md +28 -1
  70. package/agent-assets/task-flows/routine.fetch_window.md +93 -0
  71. package/agent-assets/task-flows/routine.hourly_check.md +44 -5
  72. package/agent-assets/task-flows/routine.monthly_review.md +13 -2
  73. package/agent-assets/task-flows/routine.morning_routine.md +55 -42
  74. package/agent-assets/task-flows/routine.morning_routine_initial.md +37 -38
  75. package/agent-assets/task-flows/routine.roadmap_refresh.md +38 -46
  76. package/agent-assets/task-flows/routine.today_refresh.md +53 -96
  77. package/agent-assets/task-flows/routine.weekly_review.md +40 -17
  78. package/agent-assets/task-flows/scheduled.dm.md +13 -11
  79. package/agent-assets/task-flows/scheduled.task.md +2 -2
  80. package/agent-assets/task-flows/setup.initial.md +5 -4
  81. package/agent-assets/task-flows/setup.update.md +1 -1
  82. package/agent-assets/templates/README.md +13 -6
  83. package/package.json +4 -4
  84. package/scripts/regen-skill-fixtures.mjs +39 -0
  85. package/agent-assets/task-flows/routine.hourly_check.delegated.claude.md +0 -405
  86. package/agent-assets/task-flows/routine.hourly_check.delegated.codex.md +0 -400
  87. package/agent-assets/task-flows/routine.hourly_check.delegated.gemini.md +0 -404
@@ -29,17 +29,40 @@ workflow; the skill owns the file contract.
29
29
  ### Phase 1: Gather the week
30
30
  1. Determine the target file name from <current_time>:
31
31
  `weekly/YYYY-Www.md` (ISO week in the daemon timezone).
32
- 2. Fetch the source days for the current week:
32
+ 2. Read the past-7-day calendar retrospective. The pre-pass fetcher
33
+ session (`routine.fetch_window`) ran ahead of you and posted
34
+ observations for the `cal_past_7d` window for every active calendar
35
+ integration (Google + Outlook). The `<fetch_report>` block in your
36
+ prompt tells you the pre-pass status — `success` / `partial` means
37
+ the table is fresh; `failed` / `skipped` means trust nothing newer
38
+ than the prior tick and treat the retrospective as best-effort. The
39
+ ContextBuilder block `<calendar_events_7d>` already covers the
40
+ forward-looking next-7-days view; this step adds the retrospective
41
+ complement so the review surfaces what actually happened, not just
42
+ what's coming next.
43
+
44
+ Drain pending past-week observations:
45
+
46
+ ```
47
+ GET /api/observations?pending=true&source_prefix=google_calendar:,outlook_calendar:&observed_at_after=<week_start_iso>&limit=200
48
+ ```
49
+
50
+ Treat each row's `payload.raw` (`title` / `start` / `end` /
51
+ `attendees` / `status`) as authoritative; cross-reference against the
52
+ daily files in step 3 below to disambiguate attended vs cancelled
53
+ meetings.
54
+ 3. Fetch the source days for the current week:
33
55
  - Use GET /api/context/list/daily to discover archived daily files.
34
56
  - Read each `daily/YYYY-MM-DD.md` whose date falls in the current ISO week.
35
57
  - Include <today> as the in-progress final day if it belongs to the same week.
36
- 3. Use <roadmap>, <active_projects>, and <calendar_events_7d> to understand:
37
- - which milestones moved this week,
58
+ 4. Use <roadmap>, <active_projects>, and <calendar_events_7d> to understand:
59
+ - which milestones moved this week (cross-reference with Step 2's
60
+ retrospective observations),
38
61
  - what remains incomplete,
39
62
  - what needs attention next week.
40
63
 
41
64
  ### Phase 2: Synthesize — split into two buckets
42
- 4. Build TWO separate mental lists before writing anything:
65
+ 5. Build TWO separate mental lists before writing anything:
43
66
  a. **User-facing bucket** (goes to `weekly/YYYY-Www.md` and possibly notify):
44
67
  - What meaningful user work moved forward this week?
45
68
  - Which user tasks or commitments slipped or stalled (with the reason
@@ -57,13 +80,13 @@ workflow; the skill owns the file contract.
57
80
  prioritization call this week
58
81
  - Concrete system improvement ideas (tighter silence gates, prompt
59
82
  adjustments, missing context features)
60
- 5. Anything that fits the agent-internal bucket MUST NOT land in the
83
+ 6. Anything that fits the agent-internal bucket MUST NOT land in the
61
84
  user-facing file or notification. When in doubt about a line item: "would
62
85
  the user act on this, or is it a note about how the agent is doing?" →
63
86
  agent-internal if the latter.
64
87
 
65
88
  ### Phase 3a: Write the user-facing review
66
- 6. PUT the review to `weekly/YYYY-Www.md`.
89
+ 7. PUT the review to `weekly/YYYY-Www.md`.
67
90
  Required structure (user outcomes only — no agent mechanics in any section):
68
91
  ```
69
92
  ---
@@ -95,11 +118,11 @@ workflow; the skill owns the file contract.
95
118
  The `## Metrics` section tracks **user** activity only. Do not add rows
96
119
  like "agent plan rows completed", "scheduled tasks fired", "observations
97
120
  processed" — those are agent mechanics and belong in agent/journal.md.
98
- 7. If the review reveals roadmap drift or stale project status, update
121
+ 8. If the review reveals roadmap drift or stale project status, update
99
122
  roadmap.md and the relevant projects/*.md in the same session.
100
123
 
101
124
  ### Phase 3b: Append to agent/journal.md (internal)
102
- 8. PATCH-append a new section to `agent/journal.md` with the agent-internal
125
+ 9. PATCH-append a new section to `agent/journal.md` with the agent-internal
103
126
  bucket from Phase 2. Use `mode: "append_to_file"` (no `section` param
104
127
  needed — content is appended to the end of the file).
105
128
  Required shape for the appended block — **these bullet caps are hard
@@ -144,10 +167,10 @@ workflow; the skill owns the file contract.
144
167
  overwrite the old section in place.
145
168
 
146
169
  ### Phase 4: Notify (user-facing only)
147
- 9. The notification is for the USER, not a report of Phases 1–3. Never
148
- mention weekly/YYYY-Www.md, agent/journal.md, "Weekly Review complete",
149
- agent plan rows, did-not-fire, filter quality, observation processing,
150
- or any other internal mechanism.
170
+ 10. The notification is for the USER, not a report of Phases 1–3. Never
171
+ mention weekly/YYYY-Www.md, agent/journal.md, "Weekly Review complete",
172
+ agent plan rows, did-not-fire, filter quality, observation processing,
173
+ or any other internal mechanism.
151
174
 
152
175
  #### 4a. Silence gate — decide whether to notify at all
153
176
  Prefer silence over noise. Send **no notification** if ALL of the following
@@ -163,7 +186,7 @@ one line into agent/journal.md's "What worked" subsection:
163
186
  `silent weekly wrap-up — nothing actionable`.
164
187
 
165
188
  #### 4b. When you DO notify — content rules
166
- Answer, in the user's preferred language from the Character block:
189
+ Output language: follow `<output_language_policy>`. Answer:
167
190
  1. **One concrete win** from this week (1 line).
168
191
  2. **At most one open loop** that carries into next week, with a brief
169
192
  user-meaningful reason. Omit if Open Loops is empty.
@@ -183,7 +206,7 @@ days and the user has not yet acted on it.
183
206
  - Priority `normal`. Respects quiet hours via the notify skill contract.
184
207
  - Exactly ONE notification via POST /api/notify. Do not split.
185
208
 
186
- #### 4d. Shape example (illustrative — translate to user's language)
209
+ #### 4d. Shape example (illustrative — render in the language `<output_language_policy>` resolves to)
187
210
  Good (something worth saying):
188
211
  Big win this week: the design doc shipped Thursday.
189
212
  Still open: the API spec review — Sarah back Monday.
@@ -212,7 +235,7 @@ Run after Phase 4 regardless of whether Phase 4 sent a notification.
212
235
  Purpose: keep `user/reading-taste.md` fresh, and refresh the
213
236
  Book Candidates list.
214
237
 
215
- 10. Check whether a sweep is warranted using the exact delta check from
238
+ 11. Check whether a sweep is warranted using the exact delta check from
216
239
  the `reading` skill ("Refresh-trigger check"):
217
240
  - `GET /api/context/user/reading-taste` — treat 404 as
218
241
  `Highlights at last sweep = 0` (first sweep writes the file).
@@ -225,7 +248,7 @@ Book Candidates list.
225
248
  `reading sweep skipped — only (M-N) new highlights since last refresh`.
226
249
  - Do NOT use the `Sampled: X` line for this check — `X` is the
227
250
  sample size, not a DB count.
228
- 11. Otherwise, follow the **Reading Taste Profile** workflow in the
251
+ 12. Otherwise, follow the **Reading Taste Profile** workflow in the
229
252
  `reading` skill:
230
253
  a. Sample highlights via the skill's sampling recipe.
231
254
  b. Infer Topics / Thinking Patterns / Values / Preferred Formats
@@ -233,7 +256,7 @@ Book Candidates list.
233
256
  c. Propose ≤10 Book Candidates using existing-books exclusion.
234
257
  d. Write or PATCH `user/reading-taste.md` per the skill's
235
258
  schema.
236
- 12. If the taste profile gained ≥1 new candidate and the weekly notify
259
+ 13. If the taste profile gained ≥1 new candidate and the weekly notify
237
260
  gate in Phase 4 did NOT already fire a silent-path skip, you MAY
238
261
  append one optional line to the already-sent notification by using a
239
262
  second `POST /api/notify` — but only if the candidate is genuinely
@@ -59,11 +59,11 @@ emoji policy MUST come from:
59
59
  never overrides — persona voice rules or safety invariants.
60
60
 
61
61
  If the configured persona is formal, do NOT use the casual phrasings
62
- in the examples. Match the user's language and register from the
63
- Character block (when set), `<settings primary_language>`, and prior
64
- turns if they write in a non-English language, reply in that
65
- language. If the user prefers no emoji, omit them. The examples teach
66
- you what to put WHERE — not how to sound.
62
+ in the examples. Output language: follow `<output_language_policy>`
63
+ DM replies match the user's input language and fall back to
64
+ `<settings primary_language>` for system-initiated turns; register and
65
+ emoji policy come from the Character block (when set). The examples
66
+ teach you what to put WHERE — not how to sound.
67
67
 
68
68
  Voice drift here is high-impact: dm_session is the most
69
69
  persona-load-bearing daemon-initiated touchpoint. The user
@@ -360,13 +360,15 @@ If `filled: true` OR the matching ## Pending row is no longer `[ ]`:
360
360
 
361
361
  ### Step 2 — Compose the question
362
362
 
363
- Send a single short DM in `<settings primary_language>` whose body is
364
- naturally phrased around `<ask-hint>`. The hint is in English; render
365
- the actual question in the user's language. DO NOT mention the queue,
366
- the id, the schedule, or the word "interview". Treat skipped / "later"
367
- replies cleanly no follow-up DM the same day.
363
+ Send a single short DM whose body is naturally phrased around
364
+ `<ask-hint>`. The hint is agent-internal English (Policy A); the
365
+ rendered DM follows `<output_language_policy>` this skill
366
+ intentionally splits the two surfaces, see `user-interview/SKILL.md`.
367
+ DO NOT mention the queue, the id, the schedule, or the word
368
+ "interview". Treat skipped / "later" replies cleanly — no follow-up
369
+ DM the same day.
368
370
 
369
- Examples (English; adapt to the user's language and persona):
371
+ Examples (English source; render the DM per `<output_language_policy>` and persona):
370
372
 
371
373
  - hint: `current employer and role (or freelance / student)` →
372
374
  *"Realised I never asked — what do you do for work? (or are you
@@ -55,8 +55,8 @@ ask for confirmation before treating the plan as definite.
55
55
  - Good: `Assuming you're going to LA next month, OK to start ESTA prep?`
56
56
  - Bad: `Start the ESTA application today.`
57
57
 
58
- Keep the message short, use the user's preferred language at runtime,
59
- and preserve the uncertainty unless the task context includes a later
58
+ Keep the message short. Output language: follow `<output_language_policy>`.
59
+ Preserve the uncertainty unless the task context includes a later
60
60
  confirmation.
61
61
 
62
62
  > **DM-tone scheduled tasks live elsewhere.** Morning briefing,
@@ -7,8 +7,8 @@ Vault step already captured `settings.primary_language` (BCP-47 tag, e.g.
7
7
  `en` or `es`) and `settings.vault_mode` (`plain` or `obsidian`) — the
8
8
  latter controls how the **primary management vault** is laid out, not the
9
9
  separate external Obsidian integration. Do NOT re-ask those questions.
10
- Use `primary_language` to decide the language of user-editable prose
11
- (profile, today, journal) per B-007 §3 P6.
10
+ Output language for user-editable prose (profile, today, daily journal):
11
+ follow `<output_language_policy>`.
12
12
 
13
13
  SETUP-FLOW-REDESIGN-PLAN §5.8 — the legacy "tool selections" form was
14
14
  removed. Steps 4–6 of the wizard (Mail, Calendar, Note) already
@@ -21,8 +21,9 @@ remaining management preferences, and generate rules/management.md.
21
21
  This is a multi-turn conversation — subsequent user messages will
22
22
  arrive via session resume.
23
23
 
24
- **Always respond in the same language the user uses.** Match the
25
- user's language from the very first message.
24
+ Output language for this conversation: follow `<output_language_policy>`
25
+ match the user's input language from the very first message; fall back
26
+ to `<settings primary_language>` when input is ambiguous.
26
27
 
27
28
  ### Step 0 (silent, agent-owned) — Derive Source-of-Truth rows
28
29
 
@@ -5,7 +5,7 @@
5
5
  The user has started updating rules/management.md from the dashboard.
6
6
  The current rules are included in the <management_rules> tag.
7
7
 
8
- **Always respond in the same language the user uses.** Match the user's language.
8
+ Output language: follow `<output_language_policy>` (this is a DM-style turn match the user's input language; fall back to `<settings primary_language>` if ambiguous).
9
9
 
10
10
  ### Instructions
11
11
  1. First, briefly summarize the current rules.
@@ -5,13 +5,20 @@ Source templates used by the daemon at **fresh install** time to populate
5
5
  system / pass-through assets from here directly. User-facing scaffolds that
6
6
  must follow `primary_language` are seeded by the `setup.initial` agent flow.
7
7
 
8
- **Language policy (B-007 §3 P6)** template source lives here in English.
8
+ **Language policy (B-007 §3 P6, unified through
9
+ `docs/design/appendices/output-language-policy.md`)** — template source
10
+ lives here in English. The runtime rule is now carried by the
11
+ `<output_language_policy>` block emitted by ContextBuilder, so every
12
+ flow that writes a scaffold or refreshes one of these files follows one
13
+ shared policy reference instead of restating language wording per flow.
9
14
  System prose templates (`rules/redaction.md`, `context-index.md`,
10
- `agent/journal.md`, `.base` files) stay English regardless of locale.
11
- User-facing scaffolds (`today.md`, `roadmap.md`, `_index.md`,
12
- `routines/*.md`, `rules/journal-format.md`, `rules/journal-export.md`,
13
- `user/profile.md`) are created in the user's `primary_language` by the
14
- setup conversation before `save-rules` finalizes setup.
15
+ `agent/journal.md`, `.base` files) stay English regardless of locale
16
+ (Policy A). User-facing scaffolds (`today.md`, `roadmap.md`,
17
+ `_index.md`, `routines/*.md`, `rules/journal-format.md`,
18
+ `rules/journal-export.md`, `user/profile.md`) keep the template H2/H3
19
+ headers (skeleton, Policy B) and their body is filled in
20
+ `primary_language` by the setup conversation before `save-rules`
21
+ finalizes setup.
15
22
 
16
23
  Two rendering paths:
17
24
  1. **Pass-through** — the file is copied verbatim. Used for system prose
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aitne-sh/aitne",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Aitne — a local-first, proactive personal AI agent. A long-running TypeScript daemon is the nervous system; Claude Code (or Codex / Gemini CLI) is the brain. All persistent memory lives in local Markdown files.",
5
5
  "keywords": [
6
6
  "ai",
@@ -38,9 +38,9 @@
38
38
  "README.md"
39
39
  ],
40
40
  "dependencies": {
41
- "@aitne/daemon": "0.1.3",
42
- "@aitne/dashboard": "0.1.3",
43
- "@aitne/shared": "0.1.3"
41
+ "@aitne/daemon": "0.1.4",
42
+ "@aitne/dashboard": "0.1.4",
43
+ "@aitne/shared": "0.1.4"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@typescript-eslint/eslint-plugin": "^8.58.1",
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ // Regenerate __fixtures__/skill-bodies/<slug>-pre-migration.md after an
3
+ // intentional SKILL.md edit. See skills-compiler.test.ts:660 "If a fixture
4
+ // genuinely needs to change…" — this just automates that snippet.
5
+ import { readFileSync, writeFileSync } from "node:fs";
6
+ import { dirname, join, resolve } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { renderReferenceIncludes } from "../packages/daemon/dist/core/skills-compiler.js";
9
+
10
+ const here = dirname(fileURLToPath(import.meta.url));
11
+ const repoRoot = resolve(here, "..");
12
+ const skillsDir = join(repoRoot, "agent-assets", "skills");
13
+ const fixturesDir = join(
14
+ repoRoot,
15
+ "packages/daemon/src/core/__fixtures__/skill-bodies",
16
+ );
17
+
18
+ function stripFrontmatter(content) {
19
+ if (!content.startsWith("---")) return content;
20
+ const endIdx = content.indexOf("\n---", 3);
21
+ if (endIdx < 0) return content;
22
+ return content.slice(endIdx + 4).replace(/^\n+/, "");
23
+ }
24
+
25
+ const slugs = process.argv.slice(2);
26
+ if (slugs.length === 0) {
27
+ console.error("usage: regen-skill-fixtures.mjs <slug> [slug ...]");
28
+ process.exit(1);
29
+ }
30
+
31
+ for (const slug of slugs) {
32
+ const skillPath = join(skillsDir, slug, "SKILL.md");
33
+ const fixturePath = join(fixturesDir, `${slug}-pre-migration.md`);
34
+ const skillContent = readFileSync(skillPath, "utf-8");
35
+ const expanded = renderReferenceIncludes(skillContent, join(skillsDir, slug));
36
+ const body = stripFrontmatter(expanded);
37
+ writeFileSync(fixturePath, body);
38
+ console.log(`wrote ${fixturePath} (${body.length} bytes)`);
39
+ }