@aitne-sh/aitne 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +195 -829
- package/agent-assets/agent-profiles/_safety.md +49 -17
- package/agent-assets/agent-profiles/profile-importer.md +1 -1
- package/agent-assets/agent-profiles/routine.md +4 -3
- package/agent-assets/docs/concepts/agent-day.md +6 -1
- package/agent-assets/docs/concepts/auth-health.md +10 -1
- package/agent-assets/docs/concepts/backends-and-tiers.md +74 -40
- package/agent-assets/docs/concepts/costs-and-quotas.md +25 -5
- package/agent-assets/docs/concepts/delegated-mode.md +147 -68
- package/agent-assets/docs/concepts/memory-model.md +9 -4
- package/agent-assets/docs/concepts/observations.md +13 -1
- package/agent-assets/docs/concepts/process-keys.md +20 -5
- package/agent-assets/docs/concepts/routines.md +38 -20
- package/agent-assets/docs/concepts/safety-model.md +30 -13
- package/agent-assets/docs/concepts/skills.md +12 -7
- package/agent-assets/docs/features/integrations/calendar.md +1 -1
- package/agent-assets/docs/features/integrations/git.md +2 -2
- package/agent-assets/docs/features/integrations/github.md +9 -2
- package/agent-assets/docs/features/integrations/mail.md +1 -1
- package/agent-assets/docs/features/integrations/notion.md +34 -6
- package/agent-assets/docs/features/integrations/obsidian.md +7 -2
- package/agent-assets/docs/features/lifestyle/git.md +4 -7
- package/agent-assets/docs/features/lifestyle/receipts.md +17 -2
- package/agent-assets/docs/features/lifestyle/travel-bookings.md +15 -0
- package/agent-assets/docs/features/lifestyle/travel-time.md +7 -1
- package/agent-assets/docs/features/memory-files/agent-journal.md +2 -2
- package/agent-assets/docs/features/memory-files/projects.md +6 -0
- package/agent-assets/docs/features/memory-files/roadmap.md +5 -0
- package/agent-assets/docs/features/memory-files/today.md +1 -0
- package/agent-assets/docs/features/memory-files/user-profile.md +6 -0
- package/agent-assets/docs/features/messaging/bang-commands.md +20 -10
- package/agent-assets/docs/features/messaging/discord.md +12 -1
- package/agent-assets/docs/features/messaging/overview.md +10 -7
- package/agent-assets/docs/features/messaging/slack.md +13 -1
- package/agent-assets/docs/features/messaging/telegram.md +7 -1
- package/agent-assets/docs/features/messaging/whatsapp.md +12 -1
- package/agent-assets/docs/features/operations/activity-and-conversations.md +2 -2
- package/agent-assets/docs/features/operations/approvals.md +6 -0
- package/agent-assets/docs/features/operations/backend-routing.md +7 -0
- package/agent-assets/docs/features/operations/cost-tracking.md +6 -0
- package/agent-assets/docs/features/operations/notifications.md +6 -0
- package/agent-assets/docs/features/operations/schedule-approaching.md +22 -9
- package/agent-assets/docs/features/routines/custom-routines.md +10 -4
- package/agent-assets/docs/features/routines/evening-review.md +1 -1
- package/agent-assets/docs/features/routines/hourly-check.md +1 -1
- package/agent-assets/docs/features/routines/morning-routine.md +24 -15
- package/agent-assets/docs/features/routines/weekly-review.md +38 -12
- package/agent-assets/docs/features/wiki/commands.md +11 -0
- package/agent-assets/docs/features/wiki/overview.md +13 -3
- package/agent-assets/docs/getting-started/01-what-is-this.md +32 -11
- package/agent-assets/docs/getting-started/02-first-steps.md +17 -4
- package/agent-assets/docs/getting-started/03-what-can-this-do.md +21 -11
- package/agent-assets/docs/getting-started/04-first-day.md +14 -0
- package/agent-assets/docs/glossary.md +65 -12
- package/agent-assets/docs/guides/add-a-custom-routine.md +12 -0
- package/agent-assets/docs/guides/backup-and-restore.md +16 -2
- package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +6 -0
- package/agent-assets/docs/guides/build-your-wiki.md +14 -0
- package/agent-assets/docs/guides/change-which-model-handles-x.md +7 -0
- package/agent-assets/docs/guides/connect-a-new-mail-account.md +16 -0
- package/agent-assets/docs/guides/explore-with-trace-and-connect.md +6 -0
- package/agent-assets/docs/guides/import-knowledge-file.md +11 -0
- package/agent-assets/docs/guides/install-and-run.md +20 -4
- package/agent-assets/docs/guides/maintain-wiki-health.md +6 -0
- package/agent-assets/docs/guides/migrate-machines.md +13 -1
- package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +9 -0
- package/agent-assets/docs/guides/pause-the-agent.md +12 -4
- package/agent-assets/docs/guides/reinstall-cleanly.md +19 -4
- package/agent-assets/docs/guides/setup-wizard.md +20 -9
- package/agent-assets/docs/guides/switch-default-backend.md +10 -1
- package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +5 -0
- package/agent-assets/docs/reference/api.md +29 -1
- package/agent-assets/docs/reference/cli-commands.md +22 -3
- package/agent-assets/docs/reference/config.md +37 -5
- package/agent-assets/docs/reference/disallowed-tools.md +13 -0
- package/agent-assets/docs/reference/keyboard-shortcuts.md +13 -0
- package/agent-assets/docs/reference/process-keys.md +70 -20
- package/agent-assets/docs/reference/skills.md +27 -9
- package/agent-assets/docs/troubleshooting/auth-failed.md +7 -2
- package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +13 -1
- package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +10 -0
- package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +11 -0
- package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +9 -4
- package/agent-assets/docs/troubleshooting/observation-not-detected.md +12 -0
- package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -1
- package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +5 -0
- package/agent-assets/docs/troubleshooting/wiki-write-failed.md +5 -0
- package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +1 -1
- package/agent-assets/optimizer-skills/skill-curation/SKILL.md +2 -2
- package/agent-assets/skills/agent-actions/SKILL.md +122 -0
- package/agent-assets/skills/attach/SKILL.md +1 -2
- package/agent-assets/skills/context/SKILL.md +36 -454
- package/agent-assets/skills/context/references/api.md +220 -0
- package/agent-assets/skills/context/references/required-frontmatter.md +73 -0
- package/agent-assets/skills/context/references/snapshot-files.md +103 -0
- package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +1 -1
- package/agent-assets/skills/docs-search/SKILL.md +13 -13
- package/agent-assets/skills/external-services/SKILL.delegated.claude.md +5 -7
- package/agent-assets/skills/external-services/SKILL.delegated.codex.md +5 -7
- package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +5 -7
- package/agent-assets/skills/external-services/SKILL.md +6 -259
- package/agent-assets/skills/external-services/SKILL.native.claude.md +1 -2
- package/agent-assets/skills/external-services/SKILL.native.codex.md +1 -2
- package/agent-assets/skills/external-services/SKILL.native.gemini.md +1 -2
- package/agent-assets/skills/external-services/references/calendar-apple.md +97 -0
- package/agent-assets/skills/external-services/references/calendar-google.md +72 -0
- package/agent-assets/skills/external-services/references/calendar-outlook.md +36 -0
- package/agent-assets/skills/external-services/references/github.md +17 -0
- package/agent-assets/skills/external-services/references/obsidian.md +49 -0
- package/agent-assets/skills/external-services/references/skills-crud.md +27 -0
- package/agent-assets/skills/gmail-lifestyle/SKILL.md +224 -0
- package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +93 -0
- package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +75 -0
- package/agent-assets/skills/gmail-lifestyle/references/travel-time-api.md +59 -0
- package/agent-assets/skills/mail/SKILL.delegated.claude.md +1 -1
- package/agent-assets/skills/mail/SKILL.delegated.codex.md +1 -1
- package/agent-assets/skills/mail/SKILL.delegated.gemini.md +1 -1
- package/agent-assets/skills/mail/SKILL.md +9 -114
- package/agent-assets/skills/mail/SKILL.native.claude.md +1 -1
- package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
- package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
- package/agent-assets/skills/mail/references/api.md +108 -0
- package/agent-assets/skills/mail/references/examples.md +70 -0
- package/agent-assets/skills/mail/references/providers.md +8 -8
- package/agent-assets/skills/managed-tasks/SKILL.md +472 -0
- package/agent-assets/skills/managed-tasks/references/errors.md +70 -0
- package/agent-assets/skills/managed-tasks/references/output-path.md +75 -0
- package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +86 -0
- package/agent-assets/skills/management-policy/SKILL.md +33 -105
- package/agent-assets/skills/management-policy/references/policy-workflow.md +101 -0
- package/agent-assets/skills/notify/SKILL.md +6 -78
- package/agent-assets/skills/notify/references/priority.md +60 -0
- package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
- package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
- package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
- package/agent-assets/skills/notion/SKILL.md +6 -10
- package/agent-assets/skills/notion/SKILL.native.claude.md +1 -2
- package/agent-assets/skills/notion/SKILL.native.codex.md +1 -2
- package/agent-assets/skills/notion/SKILL.native.gemini.md +1 -2
- package/agent-assets/skills/observations/SKILL.md +1 -6
- package/agent-assets/skills/project-doc/SKILL.md +1 -5
- package/agent-assets/skills/reading/SKILL.md +2 -2
- package/agent-assets/skills/roadmap/SKILL.md +37 -135
- package/agent-assets/skills/roadmap/references/api.md +100 -0
- package/agent-assets/skills/roadmap/references/cross-check.md +73 -0
- package/agent-assets/skills/roadmap/references/migration.md +56 -0
- package/agent-assets/skills/roadmap/references/preparation-timeline.md +2 -2
- package/agent-assets/skills/schedule/SKILL.md +52 -88
- package/agent-assets/skills/schedule/references/batch.md +93 -0
- package/agent-assets/skills/schedule/references/errors.md +214 -0
- package/agent-assets/skills/schedule/references/model-selection.md +96 -0
- package/agent-assets/skills/schedule/references/recurrence-rule.md +86 -0
- package/agent-assets/skills/schedule/references/recurring.md +185 -0
- package/agent-assets/skills/scheduled-managed-task/SKILL.md +13 -15
- package/agent-assets/skills/today/SKILL.md +27 -57
- package/agent-assets/skills/today/references/agent-plan-lifecycle.md +113 -0
- package/agent-assets/skills/user-interview/SKILL.md +12 -59
- package/agent-assets/skills/user-interview/references/op-briefing.md +51 -0
- package/agent-assets/skills/user-interview/references/op-morning.md +59 -0
- package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
- package/agent-assets/skills/user-profile/SKILL.md +43 -63
- package/agent-assets/skills/user-profile/references/character-preferences.md +83 -0
- package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +28 -0
- package/agent-assets/skills/wiki/wiki-ask/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-compile/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-connect/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-graduate/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-lint/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-trace/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +0 -1
- package/agent-assets/system-prompts/routine-fetch-window.md +68 -0
- package/agent-assets/system-prompts/skill-index-instruction.md +26 -0
- package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +18 -11
- package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +16 -9
- package/agent-assets/task-flows/_partials/capture-user-info.md +24 -0
- package/agent-assets/task-flows/_partials/confirm-subflow.md +68 -0
- package/agent-assets/task-flows/_partials/dm-intent.long-horizon.md +35 -0
- package/agent-assets/task-flows/_partials/dm-intent.project.md +391 -0
- package/agent-assets/task-flows/_partials/mail-acquire.gmail.md +20 -11
- package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +17 -9
- package/agent-assets/task-flows/_partials/notion-acquire.notion.md +18 -12
- package/agent-assets/task-flows/knowledge.import.md +1 -1
- package/agent-assets/task-flows/message.received.dm.md +13 -15
- package/agent-assets/task-flows/message.received.dm_first.md +10 -14
- package/agent-assets/task-flows/routine.custom.md +3 -1
- package/agent-assets/task-flows/routine.evening_review.md +39 -163
- package/agent-assets/task-flows/routine.fetch_window.md +17 -12
- package/agent-assets/task-flows/routine.hourly_check.md +16 -8
- package/agent-assets/task-flows/routine.hourly_check.triage.md +1 -1
- package/agent-assets/task-flows/routine.monthly_review.md +46 -4
- package/agent-assets/task-flows/routine.morning_routine_journal.md +113 -0
- package/agent-assets/task-flows/routine.morning_routine_today.md +673 -0
- package/agent-assets/task-flows/routine.roadmap_refresh.md +60 -15
- package/agent-assets/task-flows/routine.user_profile_sweep.md +9 -10
- package/agent-assets/task-flows/routine.weekly_review.md +285 -70
- package/agent-assets/task-flows/scheduled.dm.md +8 -8
- package/agent-assets/task-flows/scheduled.task.md +5 -5
- package/agent-assets/task-flows/setup.initial.md +165 -245
- package/agent-assets/task-flows/wiki.ingest_url.md +1 -1
- package/agent-assets/templates/_manifest.json +7 -7
- package/agent-assets/templates/dossiers/_index.md +1 -1
- package/agent-assets/templates/rules/journal-format.md +145 -38
- package/agent-assets/templates/user/expertise.md +4 -2
- package/agent-assets/templates/user/goals.md +4 -2
- package/agent-assets/templates/user/people.md +8 -2
- package/agent-assets/templates/user/personal.md +4 -2
- package/agent-assets/templates/user/work.md +4 -2
- package/bin/aitne.mjs +8 -1
- package/package.json +4 -4
- package/scripts/commands/doctor.mjs +52 -0
- package/scripts/commands/run-now.mjs +202 -0
- package/scripts/commands/verify.mjs +264 -0
- package/agent-assets/docs/features/routines/monthly-review.md +0 -65
- package/agent-assets/skills/management-task-modify/SKILL.md +0 -203
- package/agent-assets/skills/management-task-register/SKILL.md +0 -330
- package/agent-assets/skills/management-task-stop/SKILL.md +0 -166
- package/agent-assets/skills/receipts/SKILL.md +0 -134
- package/agent-assets/skills/travel/SKILL.md +0 -132
- package/agent-assets/skills/travel-time/SKILL.md +0 -158
- package/agent-assets/task-flows/routine.morning_routine.md +0 -322
- package/agent-assets/task-flows/routine.morning_routine_initial.md +0 -204
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
type: rule
|
|
3
3
|
slug: journal-format
|
|
4
4
|
owner: user
|
|
5
|
-
updated: 2026-
|
|
6
|
-
template_version:
|
|
5
|
+
updated: 2026-05-16
|
|
6
|
+
template_version: 3
|
|
7
7
|
---
|
|
8
8
|
# Daily journal — format template
|
|
9
9
|
|
|
@@ -13,49 +13,156 @@ reads it as a **format spec** (body structure, required/optional sections,
|
|
|
13
13
|
voice) — it does NOT follow this as code; natural-language guidance is
|
|
14
14
|
fine.
|
|
15
15
|
|
|
16
|
+
## Framing — this is the user's diary
|
|
17
|
+
|
|
18
|
+
`daily/<date>.md` is the **user's diary**, not the agent's behavior
|
|
19
|
+
log. It records the user's day: what the user did, what the user
|
|
20
|
+
talked about, what was on their schedule. The agent is the author
|
|
21
|
+
because the human user doesn't journal by hand — but the perspective,
|
|
22
|
+
voice, and content all belong to the user.
|
|
23
|
+
|
|
24
|
+
Agent-side bookkeeping (action counts, internal anomalies, audit
|
|
25
|
+
trail) lives in `agent/journal.md` — not here. If you find yourself
|
|
26
|
+
about to log "the agent ran N tools today" or "the hourly check
|
|
27
|
+
fired M times", that belongs in the agent-side log instead. Filter
|
|
28
|
+
it out.
|
|
29
|
+
|
|
30
|
+
The daemon's `journal-skeleton-builder`
|
|
31
|
+
(`docs/design/appendices/morning-routine-optimization.md` §"Daemon-side
|
|
32
|
+
modules to add" — Phase 2 daemon primitive) emits scratch data
|
|
33
|
+
(`## Schedule`, `## Tasks`, `## Conversations`) read from SQLite +
|
|
34
|
+
yesterday.md. Stage B **authors the entire body** per the section
|
|
35
|
+
list below, using the scratch sections as input data — the skeleton
|
|
36
|
+
sections are NOT preserved verbatim. Only the skeleton-owned
|
|
37
|
+
frontmatter MUST be preserved byte-for-byte; the daemon's daily-write
|
|
38
|
+
chokepoint validates frontmatter drift with
|
|
39
|
+
`context.skeleton_field_drift` and rejects the PUT with 422. Body
|
|
40
|
+
content (section names, ordering, prose) is Stage B's responsibility
|
|
41
|
+
and not validated for drift.
|
|
42
|
+
|
|
16
43
|
## Required frontmatter fields
|
|
17
|
-
|
|
18
|
-
-
|
|
44
|
+
|
|
45
|
+
Skeleton-owned (preserved byte-for-byte by Stage B):
|
|
46
|
+
- `date`, `weekday`, `type: daily`, `owner: agent`, `agent_generated: true`
|
|
47
|
+
- `calendar_events: <count>` — total calendar events filtered to the
|
|
48
|
+
agent-day window
|
|
49
|
+
- `messages_handled: <count>` — **incoming user messages only**
|
|
50
|
+
(`messages.role='user'` rows within the agent-day window). Agent
|
|
51
|
+
replies and internal `system` rows are excluded so the value
|
|
52
|
+
matches "how many messages did the user send today" rather than
|
|
53
|
+
total conversation turns. (Field name kept for backward
|
|
54
|
+
compatibility with already-written daily journals; a future rename
|
|
55
|
+
to `messages_received` is deferred.)
|
|
56
|
+
- `updated: <YYYY-MM-DD>` — today's agent-day, stamped by the daemon
|
|
57
|
+
at skeleton-build time. The generic context-frontmatter validator
|
|
58
|
+
requires this field on every `daily/*.md` PUT; emitting it from the
|
|
59
|
+
daemon (instead of leaving it as a Stage-B placeholder) eliminates
|
|
60
|
+
the 422 failure mode where Stage B forgot to fill the slot.
|
|
61
|
+
|
|
62
|
+
Stage B-owned (filled from the narrative Stage B authors):
|
|
63
|
+
- `agent_last_synced_at` (ISO 8601), `content_hash` (`sha256:<hex>`)
|
|
19
64
|
- `projects: [...]`, `people: [...]`, `tags: [...]`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
|
|
66
|
+
## Required body sections (Stage B output order)
|
|
67
|
+
|
|
68
|
+
Stage B authors each section below. Annotations describe the scratch
|
|
69
|
+
data Stage B reads from the daemon-emitted skeleton; the skeleton
|
|
70
|
+
section names happen to match the output section names, but Stage B
|
|
71
|
+
remains free to reshape data, add bullets, drop a section on a sparse
|
|
72
|
+
day, etc.
|
|
73
|
+
|
|
74
|
+
1. `# YYYY-MM-DD (Weekday)` — title. Stage B emits verbatim from the
|
|
75
|
+
skeleton's title line.
|
|
76
|
+
2. `## Summary` — **one paragraph, 3–5 sentences, first-person voice
|
|
77
|
+
from the user's perspective**. Authored entirely by Stage B (no
|
|
78
|
+
skeleton placeholder). Placed first so the reader's eye lands on
|
|
79
|
+
the narrative synthesis before the raw-fact sections that follow
|
|
80
|
+
(TL;DR-at-top reading order matching the pre-rev2 daily journal
|
|
81
|
+
corpus the user has accumulated). The voice is **the user's**, not
|
|
82
|
+
the agent's — "I shipped X", "I met with Y", "I felt rushed about
|
|
83
|
+
Z". Don't write about what the agent did ("the agent triaged 4
|
|
84
|
+
inbox items") — that's footprint, not diary content.
|
|
85
|
+
3. `## Schedule` — yesterday's events the user attended (or had
|
|
86
|
+
planned). Each line is `- HH:MM — <title>` for timed events, `-
|
|
87
|
+
<title>` for all-day. `- (none)` when the day carried no events.
|
|
88
|
+
Stage B reads the skeleton's `## Schedule` scratch section as
|
|
89
|
+
input; may add `(attended)` / `(skipped)` flags from yesterday
|
|
90
|
+
context.
|
|
91
|
+
4. `## Tasks` — yesterday's `## User Tasks` carried forward, checkbox
|
|
92
|
+
markers stripped, `(none)` placeholder filtered. These are the
|
|
93
|
+
things the user was meant to do — keep them user-side (not
|
|
94
|
+
agent-side schedule rows). `- (none)` when yesterday had no User
|
|
95
|
+
Tasks. Stage B reads the skeleton's `## Tasks` scratch section as
|
|
96
|
+
input.
|
|
97
|
+
5. `## Conversations` — **what the user talked about that day**, as
|
|
98
|
+
topic-level bullets. Stage B reads the skeleton's
|
|
99
|
+
`## Conversations` scratch section (rolling DM summaries with
|
|
100
|
+
HH:MM + message counts) and synthesises **2–5 topic bullets** in
|
|
101
|
+
the user's voice, e.g. `- Discussed Q2 roadmap with the agent —
|
|
102
|
+
agreed to defer feature X`. The HH:MM and `(n=N)` markers from
|
|
103
|
+
the scratch input are NOT preserved verbatim; they're inputs for
|
|
104
|
+
topic synthesis, not output structure. `- (none)` when no DM
|
|
105
|
+
activity. Skip mechanical per-thread enumeration — collapse to
|
|
106
|
+
topics.
|
|
107
|
+
|
|
108
|
+
**Sections deliberately NOT in the daily journal:**
|
|
109
|
+
|
|
110
|
+
- ❌ Agent action counts (`agent_actions` breakdown by type). Lives
|
|
111
|
+
in `agent/journal.md` instead — the audit-trail footprint.
|
|
112
|
+
- ❌ Internal stage status, retry counts, anomalies. Same as above.
|
|
113
|
+
- ❌ "The agent did X for the user" framing. The user's diary uses
|
|
114
|
+
user voice; agent meta-narration belongs in the agent-side log.
|
|
115
|
+
|
|
116
|
+
## Voice (`## Summary` and `## Conversations`)
|
|
117
|
+
|
|
118
|
+
- First-person **from the user's perspective** ("I shipped...", "I
|
|
119
|
+
met with...", "I asked the agent about..."), concise, factual
|
|
42
120
|
- Written in `settings.primary_language`; keep technical terms in their
|
|
43
121
|
original form if that's how the user writes them
|
|
122
|
+
- Refers to the entities Stage B surfaces in the body sections that
|
|
123
|
+
follow (the meetings under `## Schedule`, the tasks under
|
|
124
|
+
`## Tasks`, the topics under `## Conversations`) so the narrative
|
|
125
|
+
reads as a synthesis of those facts, not a separate stream of
|
|
126
|
+
consciousness
|
|
44
127
|
|
|
45
128
|
## Wikilink rendering
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
129
|
+
|
|
130
|
+
- When `settings.vault_mode` is `obsidian`, Stage B renders project /
|
|
131
|
+
people references throughout the body as `[[wikilinks]]` targeting
|
|
132
|
+
`projects/<slug>.md` or `user/people.md#<person>` (basename resolves
|
|
133
|
+
automatically). The `## Summary` paragraph is the primary surface,
|
|
134
|
+
but data sections may also receive wikilinks where a project / person
|
|
135
|
+
name appears (e.g. a meeting title containing a person's name).
|
|
136
|
+
- When `vault_mode` is `plain`, Stage B writes plain text only — no
|
|
137
|
+
double brackets, no link markup.
|
|
138
|
+
- The skeleton's scratch sections do not embed wikilinks; Stage B
|
|
139
|
+
applies them as it authors the final body.
|
|
51
140
|
|
|
52
141
|
## Redaction
|
|
53
|
-
|
|
54
|
-
- Apply `rules/
|
|
55
|
-
|
|
56
|
-
|
|
142
|
+
|
|
143
|
+
- Apply `rules/redaction.md` patterns to the entire body Stage B
|
|
144
|
+
authors (Summary + data sections both — Stage B owns the body, so
|
|
145
|
+
redaction applies wherever sensitive content might surface).
|
|
146
|
+
- Apply `rules/journal-export.md` user rules to the entire body.
|
|
147
|
+
- If yesterday.md frontmatter had `no_journal_export: true`, write
|
|
148
|
+
`[Skipped by user request]` as the body of `## Summary` and omit
|
|
149
|
+
the data sections (they would echo information the export rule is
|
|
150
|
+
trying to suppress).
|
|
151
|
+
|
|
152
|
+
The skeleton's scratch sections carry data sourced from upstream
|
|
153
|
+
writers (calendar observer, yesterday.md `## User Tasks`, the
|
|
154
|
+
`dm_conversation_log` rolling-summary writer). Stage B SHOULD apply
|
|
155
|
+
redaction during authoring; but the *primary* defence belongs
|
|
156
|
+
**upstream** — if a credit-card number is appearing in
|
|
157
|
+
`dm_conversation_log` summaries, fix the rolling-summary writer
|
|
158
|
+
rather than relying on Stage B as the last line of defence. Stage
|
|
159
|
+
B's redaction is a backstop, not a safety net.
|
|
57
160
|
|
|
58
161
|
## Conflict behavior
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
162
|
+
|
|
163
|
+
Follow B-006 content-hash protection: if the user edited the previous
|
|
164
|
+
day's `daily/<date>.md`, append `## Agent revision — <ISO timestamp>`
|
|
165
|
+
rather than overwrite. The Agent revision section may carry a fresh
|
|
166
|
+
Summary + any updated data sections. The original body the user
|
|
167
|
+
edited is preserved verbatim above the Agent revision boundary;
|
|
168
|
+
Stage B does NOT rewrite sections the user touched.
|
package/bin/aitne.mjs
CHANGED
|
@@ -989,6 +989,11 @@ Operations:
|
|
|
989
989
|
open Open dashboard root in browser
|
|
990
990
|
doctor Diagnose install (Node, ports, keychain, CLIs, …)
|
|
991
991
|
audit [--since <dur>] [--type X] Show agent action log (filterable)
|
|
992
|
+
run-now <job> Fire a daemon-internal maintenance job
|
|
993
|
+
on demand (e.g. roadmap_maintenance)
|
|
994
|
+
verify [target] Run post-launch verification for a
|
|
995
|
+
shipped design surface (e.g.
|
|
996
|
+
evening-review-slimdown)
|
|
992
997
|
version Print version + Node + install path
|
|
993
998
|
update Print npm command to upgrade
|
|
994
999
|
uninstall Stop, then offer to wipe ${path.basename(DATA_DIR) || "data dir"}
|
|
@@ -1016,7 +1021,7 @@ Run 'aitne help <command>' for detailed usage of a single command.`);
|
|
|
1016
1021
|
// Used by `aitne help <cmd>` to dispatch into the module rather than duplicating
|
|
1017
1022
|
// usage strings in cmdHelp() above.
|
|
1018
1023
|
const PER_COMMAND_HELP = new Set([
|
|
1019
|
-
"doctor", "audit", "setup", "open", "version", "update", "uninstall",
|
|
1024
|
+
"doctor", "audit", "setup", "open", "version", "update", "uninstall", "run-now", "verify",
|
|
1020
1025
|
]);
|
|
1021
1026
|
|
|
1022
1027
|
/**
|
|
@@ -1069,6 +1074,8 @@ switch (subcommand) {
|
|
|
1069
1074
|
case "open": await runExternalCommand("open", subArgs); break;
|
|
1070
1075
|
case "doctor": await runExternalCommand("doctor", subArgs); break;
|
|
1071
1076
|
case "audit": await runExternalCommand("audit", subArgs); break;
|
|
1077
|
+
case "run-now": await runExternalCommand("run-now", subArgs); break;
|
|
1078
|
+
case "verify": await runExternalCommand("verify", subArgs); break;
|
|
1072
1079
|
|
|
1073
1080
|
// version / -v / --version all dispatch identically — passing subArgs
|
|
1074
1081
|
// through so `aitne --version --json` yields the same output as
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aitne-sh/aitne",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"README.md"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@aitne/daemon": "0.1.
|
|
47
|
-
"@aitne/dashboard": "0.1.
|
|
48
|
-
"@aitne/shared": "0.1.
|
|
46
|
+
"@aitne/daemon": "0.1.8",
|
|
47
|
+
"@aitne/dashboard": "0.1.8",
|
|
48
|
+
"@aitne/shared": "0.1.8"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
@@ -37,6 +37,8 @@ Exit code:
|
|
|
37
37
|
await checkPort("Dashboard port", ctx.DASHBOARD_PORT, ctx.DASHBOARD_PID_FILE, ctx.helpers.getRunningPid),
|
|
38
38
|
await checkSecretStore(ctx),
|
|
39
39
|
await checkBackendCli(),
|
|
40
|
+
await checkProcessProbe(),
|
|
41
|
+
await checkBrowserOpener(),
|
|
40
42
|
await checkDataDirWritable(ctx.DATA_DIR),
|
|
41
43
|
await checkBetterSqlite3(ctx.PROJECT_ROOT),
|
|
42
44
|
await checkAgentAssets(ctx.PROJECT_ROOT),
|
|
@@ -221,6 +223,56 @@ async function checkBackendCli() {
|
|
|
221
223
|
};
|
|
222
224
|
}
|
|
223
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Process-listing primitive — `pgrep` on POSIX, `tasklist` on Windows. The
|
|
228
|
+
* Obsidian observer uses this to ask "is the desktop app currently open?"
|
|
229
|
+
* before treating the vault as live (services/obsidian.ts). Warn (not fail)
|
|
230
|
+
* because every other observer keeps working without it.
|
|
231
|
+
*/
|
|
232
|
+
async function checkProcessProbe() {
|
|
233
|
+
const isWin = process.platform === "win32";
|
|
234
|
+
const tool = isWin ? "tasklist" : "pgrep";
|
|
235
|
+
if (whichSync(tool)) {
|
|
236
|
+
return { status: "pass", label: "Process probe", detail: `${tool} on PATH` };
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
status: "warn",
|
|
240
|
+
label: "Process probe",
|
|
241
|
+
detail: `${tool} not on PATH`,
|
|
242
|
+
hint: isWin
|
|
243
|
+
? "tasklist ships with Windows — check that %SystemRoot%\\System32 is on PATH."
|
|
244
|
+
: process.platform === "linux"
|
|
245
|
+
? "apt install procps · or equivalent for your distro."
|
|
246
|
+
: "pgrep ships with macOS in-box; check $PATH.",
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Browser opener used by `aitne open` and the auto-open after `aitne start`.
|
|
252
|
+
* darwin → `open`, win32 → `cmd` (hosts the `start` builtin), linux → `xdg-open`.
|
|
253
|
+
* Warn-only: nothing in the daemon depends on this; users can navigate to
|
|
254
|
+
* the dashboard URL by hand if missing.
|
|
255
|
+
*/
|
|
256
|
+
async function checkBrowserOpener() {
|
|
257
|
+
const platform = process.platform;
|
|
258
|
+
const tool =
|
|
259
|
+
platform === "darwin" ? "open"
|
|
260
|
+
: platform === "win32" ? "cmd"
|
|
261
|
+
: "xdg-open";
|
|
262
|
+
if (whichSync(tool)) {
|
|
263
|
+
return { status: "pass", label: "Browser opener", detail: `${tool} on PATH` };
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
status: "warn",
|
|
267
|
+
label: "Browser opener",
|
|
268
|
+
detail: `${tool} not on PATH`,
|
|
269
|
+
hint:
|
|
270
|
+
platform === "linux"
|
|
271
|
+
? "apt install xdg-utils · or open http://localhost:3000 manually after `aitne start`."
|
|
272
|
+
: "Auto-open is a convenience; the dashboard URL works in any browser.",
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
224
276
|
async function checkDataDirWritable(dataDir) {
|
|
225
277
|
try {
|
|
226
278
|
fs.mkdirSync(dataDir, { recursive: true });
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aitne run-now <job>` — fire a daemon-internal maintenance job on
|
|
3
|
+
* demand.
|
|
4
|
+
*
|
|
5
|
+
* Currently supported jobs:
|
|
6
|
+
* - `roadmap_maintenance` — mechanical roadmap.md maintenance pass
|
|
7
|
+
* (substeps 2a / 2b / 2d of the legacy `routine.evening_review`
|
|
8
|
+
* Step 2). Same code path the 17:45 cron callback fires. See
|
|
9
|
+
* `docs/design/appendices/evening-review-slimdown.md` §2.2.
|
|
10
|
+
*
|
|
11
|
+
* Implementation:
|
|
12
|
+
* - Reads the daemon's apiToken from the macOS Keychain (the same
|
|
13
|
+
* entry the dashboard proxy uses). Bearer-auth required because
|
|
14
|
+
* `POST /api/agent/run-now/*` routes are Approve-tier in the
|
|
15
|
+
* `risk-classifier`.
|
|
16
|
+
* - POSTs to `http://127.0.0.1:<PA_API_PORT>/api/agent/run-now/<job>`.
|
|
17
|
+
* - Renders the structured `result` payload as a compact summary
|
|
18
|
+
* plus the full JSON on `--json`.
|
|
19
|
+
*
|
|
20
|
+
* Exit codes:
|
|
21
|
+
* - 0 job completed (including idempotent / no-op runs)
|
|
22
|
+
* - 2 validation / argument error
|
|
23
|
+
* - 3 daemon not running, not reachable, or 5xx
|
|
24
|
+
* - 4 result.status === "failed" — the job reported errors[]
|
|
25
|
+
*/
|
|
26
|
+
import { execFileSync } from "node:child_process";
|
|
27
|
+
|
|
28
|
+
const SUPPORTED_JOBS = new Set(["roadmap_maintenance"]);
|
|
29
|
+
|
|
30
|
+
const JOB_ENDPOINTS = {
|
|
31
|
+
roadmap_maintenance: "/api/agent/run-now/roadmap-maintenance",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export async function run(args, ctx) {
|
|
35
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
36
|
+
printHelp();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const opts = parseArgs(args);
|
|
40
|
+
if (!opts.job) {
|
|
41
|
+
process.stderr.write("Job is required.\n");
|
|
42
|
+
process.stderr.write("Available jobs: " + [...SUPPORTED_JOBS].join(", ") + "\n");
|
|
43
|
+
process.stderr.write("Run `aitne help run-now` for usage.\n");
|
|
44
|
+
process.exit(2);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!SUPPORTED_JOBS.has(opts.job)) {
|
|
48
|
+
process.stderr.write(`Unknown job: ${opts.job}\n`);
|
|
49
|
+
process.stderr.write("Available jobs: " + [...SUPPORTED_JOBS].join(", ") + "\n");
|
|
50
|
+
process.exit(2);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const token = readApiToken();
|
|
54
|
+
if (!token) {
|
|
55
|
+
process.stderr.write(
|
|
56
|
+
"Failed to read daemon API token from the macOS Keychain.\n" +
|
|
57
|
+
"Is the daemon initialized? Run `aitne start` once first.\n",
|
|
58
|
+
);
|
|
59
|
+
process.exit(3);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const endpoint = JOB_ENDPOINTS[opts.job];
|
|
63
|
+
const url = `http://127.0.0.1:${ctx.DAEMON_PORT}${endpoint}`;
|
|
64
|
+
|
|
65
|
+
let res;
|
|
66
|
+
try {
|
|
67
|
+
res = await fetch(url, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
headers: {
|
|
70
|
+
"Content-Type": "application/json",
|
|
71
|
+
Authorization: `Bearer ${token}`,
|
|
72
|
+
},
|
|
73
|
+
body: JSON.stringify({}),
|
|
74
|
+
});
|
|
75
|
+
} catch (err) {
|
|
76
|
+
process.stderr.write(`Failed to reach the daemon at ${url}: ${err.message}\n`);
|
|
77
|
+
process.stderr.write("Is the daemon running? Try `aitne status`.\n");
|
|
78
|
+
process.exit(3);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const text = await res.text();
|
|
82
|
+
let body;
|
|
83
|
+
try {
|
|
84
|
+
body = JSON.parse(text);
|
|
85
|
+
} catch {
|
|
86
|
+
body = { raw: text };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!res.ok) {
|
|
90
|
+
process.stderr.write(
|
|
91
|
+
`POST ${endpoint} → ${res.status}: ${body.error ?? "unknown"}\n`,
|
|
92
|
+
);
|
|
93
|
+
if (body.message) process.stderr.write(`${body.message}\n`);
|
|
94
|
+
process.exit(res.status >= 500 ? 3 : 2);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (opts.json) {
|
|
98
|
+
process.stdout.write(JSON.stringify(body, null, 2) + "\n");
|
|
99
|
+
} else {
|
|
100
|
+
printSummary(opts.job, body.result ?? body);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const status = body?.result?.status;
|
|
104
|
+
if (status === "failed") process.exit(4);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function parseArgs(args) {
|
|
108
|
+
const opts = { job: null, json: false };
|
|
109
|
+
for (let i = 0; i < args.length; i++) {
|
|
110
|
+
const a = args[i];
|
|
111
|
+
if (a === "--json") {
|
|
112
|
+
opts.json = true;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (a.startsWith("-")) {
|
|
116
|
+
process.stderr.write(`Unknown flag: ${a}\n`);
|
|
117
|
+
process.exit(2);
|
|
118
|
+
}
|
|
119
|
+
if (opts.job) {
|
|
120
|
+
process.stderr.write(`Unexpected positional argument: ${a}\n`);
|
|
121
|
+
process.exit(2);
|
|
122
|
+
}
|
|
123
|
+
opts.job = a;
|
|
124
|
+
}
|
|
125
|
+
return opts;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function readApiToken() {
|
|
129
|
+
try {
|
|
130
|
+
return execFileSync(
|
|
131
|
+
"security",
|
|
132
|
+
[
|
|
133
|
+
"find-generic-password",
|
|
134
|
+
"-s",
|
|
135
|
+
"com.personal-agent.secret.apiToken",
|
|
136
|
+
"-w",
|
|
137
|
+
],
|
|
138
|
+
{ encoding: "utf-8" },
|
|
139
|
+
).trim();
|
|
140
|
+
} catch {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function printSummary(job, result) {
|
|
146
|
+
if (job === "roadmap_maintenance") {
|
|
147
|
+
if (!result || typeof result !== "object") {
|
|
148
|
+
process.stdout.write("(no result payload)\n");
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const status = result.status ?? "unknown";
|
|
152
|
+
const lines = [
|
|
153
|
+
`status: ${status}`,
|
|
154
|
+
`status_synced: ${result.statusSynced ?? 0}`,
|
|
155
|
+
`swept: ${result.swept ?? 0}`,
|
|
156
|
+
`stale_marked: ${result.staleMarked ?? 0}`,
|
|
157
|
+
];
|
|
158
|
+
if (result.skipReason) lines.push(`skip_reason: ${result.skipReason}`);
|
|
159
|
+
if (Array.isArray(result.errors) && result.errors.length > 0) {
|
|
160
|
+
lines.push(`errors: ${result.errors.length}`);
|
|
161
|
+
for (const err of result.errors) {
|
|
162
|
+
lines.push(` - ${err.step}: ${err.message}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function printHelp() {
|
|
172
|
+
process.stdout.write(`Usage: aitne run-now <job> [--json]
|
|
173
|
+
|
|
174
|
+
Fire a daemon-internal maintenance job on demand. Uses the same code
|
|
175
|
+
path the cron schedule fires — useful for parallel-verification
|
|
176
|
+
rollouts and operator debugging.
|
|
177
|
+
|
|
178
|
+
Jobs:
|
|
179
|
+
roadmap_maintenance Run the mechanical roadmap.md maintenance pass
|
|
180
|
+
(substeps 2a / 2b / 2d). Acquires roadmap write
|
|
181
|
+
lock, syncs Scheduled: statuses, sweeps aged
|
|
182
|
+
Agent Action Plan entries, and applies
|
|
183
|
+
Long-term Plans stale markers. Emits an
|
|
184
|
+
\`agent_actions\` audit row with
|
|
185
|
+
action_type='roadmap_mechanical_maintenance'
|
|
186
|
+
and appends a line to agent/journal.md.
|
|
187
|
+
|
|
188
|
+
Flags:
|
|
189
|
+
--json Emit the full JSON result instead of the summary.
|
|
190
|
+
-h, --help Print this message.
|
|
191
|
+
|
|
192
|
+
Exit codes:
|
|
193
|
+
0 completed (success / skipped)
|
|
194
|
+
2 argument / validation error
|
|
195
|
+
3 daemon unreachable or 5xx
|
|
196
|
+
4 the job ran but reported errors[]
|
|
197
|
+
|
|
198
|
+
Examples:
|
|
199
|
+
aitne run-now roadmap_maintenance
|
|
200
|
+
aitne run-now roadmap_maintenance --json
|
|
201
|
+
`);
|
|
202
|
+
}
|