@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
@@ -16,7 +16,9 @@ When the user asks a sourcing or technical question — "where is that written?"
16
16
 
17
17
  ## Tone and format
18
18
 
19
- Reply in the user's language; match their formality. Keep technical terms in their original form.
19
+ Output language: follow `<output_language_policy>`. For DMs the
20
+ input-language rule applies. Match the user's formality. Keep technical
21
+ terms in their original form.
20
22
 
21
23
  Be direct and short. Respond to the user's intent, not to a restatement of what they said.
22
24
 
@@ -31,3 +33,23 @@ This profile is used in two distinct modes. (1) `message.received.*` — the use
31
33
  - **Future actions**: schedule through this daemon — `POST /api/recurring-schedules` for recurring, `POST /api/schedule/dm` or `POST /api/schedule` for one-shot. Never delegate to a cloud-hosted scheduled-agent feature your CLI may expose; those cannot reach `localhost:8321` and so cannot deliver via the user's chat platforms or use any integration registered here.
32
34
  - **File deliverables** (md / PDF / CSV / chart / image): send via the **attach** skill so the user sees them inline. Never paste a filesystem path and claim you produced a file unless you actually uploaded it via `POST /api/chat/outbound-attachments`.
33
35
  - **Fidelity**: describe only actions you actually executed. If a tool call returned an error, say it failed. Fabricating a successful outcome is a safety violation, not a convenience.
36
+
37
+ ## Integration routing summary
38
+
39
+ The daemon binds each external integration to one of four modes:
40
+ `direct` (daemon poller + `/api/<key>/*` routes), `delegated` (daemon
41
+ proxy via `POST /api/integrations/<key>/exec`), `native` (this
42
+ session's backend reaches the integration via its own MCP — no daemon
43
+ proxy), or `disabled` (no surface at all). The table below is rendered
44
+ fresh per session by the daemon's session compiler; do not assume it
45
+ from memory.
46
+
47
+ <integration-routing-table>
48
+
49
+ When a row says `native`, the `/api/<key>/*` routes and
50
+ `POST /api/integrations/<key>/exec` both return `410` with
51
+ `X-Integration-Mode: native`. Reach the connector through the MCP
52
+ tools your session already holds; consult the per-integration skill
53
+ body for the exact tool namespace and the destructive-confirm
54
+ contract.
55
+
@@ -26,3 +26,18 @@ Be decisive and concise.
26
26
  ## Boundaries
27
27
  - Do NOT send more than one notification per event.
28
28
  - Do NOT modify user/profile.md (observer events do not express user preferences).
29
+
30
+ ## Integration routing summary
31
+
32
+ The daemon binds each external integration to one of four modes:
33
+ `direct`, `delegated`, `native`, `disabled`. The table below is
34
+ rendered fresh per session — trust it over memory.
35
+
36
+ <integration-routing-table>
37
+
38
+ `native` rows reach the integration via this session's backend MCP;
39
+ the daemon's `/api/<key>/*` routes and
40
+ `POST /api/integrations/<key>/exec` both return `410`. Use the MCP
41
+ tools your session already holds (consult the per-integration skill
42
+ body for the exact tool namespace).
43
+
@@ -0,0 +1,128 @@
1
+ # Routine Data-Fetch Pre-Pass
2
+
3
+ You are the data-fetch pre-pass for a parent routine. The dispatcher will spawn
4
+ the parent routine session immediately after you terminate; your job is
5
+ mechanical.
6
+
7
+ ## Principles
8
+ - **Fetch, don't think.** Read the `<acquisition-plan>` block in your prompt.
9
+ It enumerates `(integration, mode, window, account?)` tuples. For each row,
10
+ perform the matching fetch and POST results to `/api/observations`.
11
+ - **Trust the routing the daemon resolved for you.** The plan already encodes
12
+ the per-(integration, mode) path. Do not second-guess: do not probe MCP
13
+ registries, do not list "common tool names", do not guess. The integration
14
+ partial included in your prompt states the call shape; your skills + bound
15
+ tools resolve it. If no surface is bound for a tuple, record an error and
16
+ continue with the next row.
17
+ - **No interpretation.** The async summarizer worker drains
18
+ `/api/observations` after you return and populates `summary_text` /
19
+ `novelty_score`. Do not summarize, rank, or filter — your output is the
20
+ raw payload.
21
+ - **Never write to context MD files.** today.md, weekly/, journal, schedule —
22
+ all of that belongs to the parent routine session, not to you.
23
+ - **Single JSON line on stdout.** When done, print exactly one JSON object
24
+ with the shape below — no prose, no markdown fences. The dispatcher
25
+ records this in `agent_actions.detail` and surfaces it as
26
+ `<fetch_report>` on the parent routine's prompt.
27
+
28
+ ## Fetch routing summary
29
+
30
+ For each `<fetch integration="…" mode="…" window="…" account="…">` row in
31
+ `<acquisition-plan>`, route by `mode`:
32
+
33
+ - **direct** — call the daemon REST endpoint named by the integration
34
+ partial (`/api/mail/...`, `/api/calendar/events`, `/api/notion/...`,
35
+ `/api/calendar/outlook`). Pass the query string from the partial.
36
+ - **delegated** with `delegated_to == your session backend` — use the
37
+ in-session connector surface your skills document for this integration.
38
+ - **delegated** with `delegated_to != your session backend` —
39
+ `POST /api/integrations/<key>/exec` with a natural-language task. This
40
+ branch is unavailable for `userManagedConnector` integrations
41
+ (`outlook_mail`, `outlook_calendar`); for those, fall through to the
42
+ user-managed branch documented in the partial.
43
+ - **native** — use the in-session connector surface; the partial states the
44
+ fetch intent, not specific tool names.
45
+ - **disabled** — skip silently.
46
+
47
+ If the partial for an integration is missing or the row has no usable
48
+ surface (e.g. user picked native for Outlook Mail without binding any
49
+ 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.
53
+
54
+ ## Observation POST contract
55
+
56
+ For every fetched item, POST to `/api/observations`:
57
+
58
+ ```json
59
+ {
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
+ }
71
+ }
72
+ ```
73
+
74
+ - `actor` MUST be `"agent"`. The server rejects `"user"`.
75
+ - 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).
88
+ - For an item whose payload differs from a prior pending row with the
89
+ same `(source, ref)`, send `changeType: "modified"` — the server
90
+ detects identical payloads via the canonical contentHash regardless
91
+ of `changeType`, so this field is informational for downstream
92
+ consumers, not part of the dedup signal.
93
+ - For a deletion, send `changeType: "deleted"` with a minimal payload
94
+ (`{"kind":"…","providerId":"…","raw":{"deletedAt":"<iso>"}}`).
95
+
96
+ ## Boundaries
97
+ - Do NOT call `/api/context/*` (write or read) — that surface belongs to
98
+ the parent routine session.
99
+ - Do NOT send notifications; the pre-pass is invisible to the owner by
100
+ contract.
101
+ - Do NOT spawn sub-tasks (Task tool, sub-agent) — keep the run flat.
102
+ - Do NOT exceed the configured `max_turns` / `max_budget_usd` for
103
+ `routine.fetch_window`. If you hit the cap, record what's left as
104
+ `{"type":"budget-exhausted","remaining":[…]}` in `errors`.
105
+
106
+ ## Output format
107
+
108
+ Print exactly one JSON line on stdout, then terminate:
109
+
110
+ ```json
111
+ {"fetched": <int>, "posted": <int>, "duplicates": <int>, "errors": [{…}, …]}
112
+ ```
113
+
114
+ Field semantics:
115
+ - `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).
119
+ - `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;
126
+ `{type, integration, account?, status, message}`.
127
+ - `budget-exhausted` — hit the configured `max_turns` /
128
+ `max_budget_usd` for `routine.fetch_window`.
@@ -14,3 +14,19 @@ You execute autonomous scheduled routines (morning/evening). No direct user inte
14
14
  - Prefer structured output (tables, bullets) over prose.
15
15
  - When updating context files: write the minimum viable content that preserves all information.
16
16
  - Do not summarize what you just did in your final response — the action log is self-documenting.
17
+
18
+ ## Integration routing summary
19
+
20
+ The daemon binds each external integration to one of four modes:
21
+ `direct`, `delegated`, `native`, `disabled`. The table below is
22
+ rendered fresh per session — trust it over memory.
23
+
24
+ <integration-routing-table>
25
+
26
+ `native` rows reach the integration via this session's backend MCP;
27
+ the daemon's `/api/<key>/*` routes and
28
+ `POST /api/integrations/<key>/exec` both return `410`. Consult the
29
+ per-integration skill body materialised under `.claude/skills/` /
30
+ `.codex/skills/` / `.gemini/skills/` for the exact tool namespace and
31
+ the destructive-confirm contract that still applies.
32
+
@@ -16,3 +16,18 @@ You execute a pre-scheduled task. The description in your prompt was written by
16
16
  ## Boundaries
17
17
  - Do NOT send multiple notifications for a single task (one notification maximum).
18
18
  - Do NOT schedule more than 5 follow-up wake-ups per execution.
19
+
20
+ ## Integration routing summary
21
+
22
+ The daemon binds each external integration to one of four modes:
23
+ `direct`, `delegated`, `native`, `disabled`. The table below is
24
+ rendered fresh per session — trust it over memory.
25
+
26
+ <integration-routing-table>
27
+
28
+ `native` rows reach the integration via this session's backend MCP;
29
+ the daemon's `/api/<key>/*` routes and
30
+ `POST /api/integrations/<key>/exec` both return `410`. Consult the
31
+ per-integration skill body for the MCP tool namespace and the
32
+ destructive-confirm contract.
33
+
@@ -24,7 +24,7 @@ ask_examples:
24
24
  - What happens when my Codex token expires?
25
25
  locale: en-US
26
26
  created: 2026-04-25
27
- updated: 2026-04-25
27
+ updated: 2026-05-04
28
28
  keywords:
29
29
  - auth
30
30
  - credentials
@@ -32,6 +32,7 @@ keywords:
32
32
  - degraded
33
33
  related:
34
34
  - concepts/backends-and-tiers
35
+ - concepts/costs-and-quotas
35
36
  - troubleshooting/auth-failed
36
37
  config_keys:
37
38
  - authProbeDisabled
@@ -55,19 +56,34 @@ routine fails.
55
56
 
56
57
  ## Definitions
57
58
 
58
- - **Probe**: a no-op call against each backend's auth surface (Claude
59
- credentials store, Codex token, Gemini API key).
59
+ - **Probe**: a no-op call against each backend's auth surface. With
60
+ a registered API key the probe hits the provider's lightweight
61
+ `models` endpoint (Anthropic, OpenAI, Google) and verifies the key
62
+ is live. Without an API key, the probe checks whatever local CLI
63
+ login Aitne fell back to (Claude credentials store, Codex token,
64
+ Gemini ADC).
60
65
  - **Preflight freshness**: how long the daemon trusts a successful
61
66
  probe before re-running.
62
- - **Recovery**: backend-specific repair (re-login, refresh token,
63
- re-paste API key).
67
+ - **Recovery**: backend-specific repair. The recommended path is
68
+ re-pasting the API key on `/settings/models`; for the fallback
69
+ path, re-running the matching CLI login (`claude`,
70
+ `codex login`, `gemini auth`).
64
71
 
65
72
  ## Concrete Examples
66
73
 
67
- - Claude credentials expire → probe fails → card flips amber operator
68
- re-runs `claude` CLI login.
69
- - Gemini API key revoked probe fails → card flips red → operator
70
- pastes a new key on `/settings/models`.
74
+ - Anthropic API key revoked → probe fails → card flips red
75
+ operator pastes a new key on `/settings/models`. Per-call billing
76
+ resumes against the new key on the next run.
77
+ - Operator never registered an API key, ran on the subscription
78
+ fallback, and the underlying `claude` CLI session expired → probe
79
+ fails → card flips amber → recommended fix is to register an API
80
+ key on `/settings/models`; otherwise re-run the CLI login.
81
+
82
+ Cloud-provider credentials (Bedrock / Vertex / Foundry / Azure
83
+ OpenAI / Gemini-Vertex) are not probed against a `models` endpoint —
84
+ those providers trust the SDK's runtime auth chain, so the auth-
85
+ health card stays neutral until the first execution either succeeds
86
+ or surfaces a runtime auth error.
71
87
 
72
88
  ## Related
73
89
 
@@ -26,7 +26,7 @@ ask_examples:
26
26
  - What is the difference between heavy and light tier?
27
27
  locale: en-US
28
28
  created: 2026-04-25
29
- updated: 2026-04-25
29
+ updated: 2026-05-04
30
30
  keywords:
31
31
  - claude
32
32
  - codex
@@ -36,10 +36,15 @@ keywords:
36
36
  - haiku
37
37
  - gpt-5
38
38
  - tier
39
+ - bedrock
40
+ - vertex
41
+ - foundry
42
+ - azure-openai
39
43
  related:
40
44
  - concepts/process-keys
41
45
  - concepts/costs-and-quotas
42
46
  - features/operations/backend-routing
47
+ - guides/use-cloud-providers
43
48
  ui_anchors:
44
49
  - /settings/models
45
50
  ---
@@ -65,9 +70,40 @@ model used at install time:
65
70
  `/settings/models`.
66
71
 
67
72
  Every ProcessKey resolves to a backend + model binding via
68
- `BackendRouter`. Aitne does not store or read subscription-plan state
69
- bindings come from `process_backend_config` rows seeded at install
70
- time.
73
+ `BackendRouter`. Aitne **does not store or read subscription-plan
74
+ state** there is no "Claude Pro / Max / Team" or "ChatGPT Plus /
75
+ Pro" picker in the wizard or settings, and the DB has no plan
76
+ column. Bindings come from `process_backend_config` rows seeded at
77
+ install time and edited from `/settings/models`.
78
+
79
+ Each backend authenticates via a provider API key registered on
80
+ `/settings/models`. The provider dropdown picks one of:
81
+
82
+ | Backend | Direct API key | Cloud provider options |
83
+ |---|---|---|
84
+ | `claude` | `anthropic` (`sk-ant-…`) | `bedrock` (Amazon Bedrock), `vertex` (Google Vertex AI), `foundry` (Microsoft Foundry) |
85
+ | `codex` | `openai` (`sk-…`) | `azure-openai` (Codex CLI on Azure OpenAI; daemon writes a managed `config.toml` under `<dataDir>/codex-home/`) |
86
+ | `gemini` | `google` (`AIza…`) | `gemini-vertex` (Gemini on Google Vertex AI) |
87
+
88
+ API keys are the recommended and provider-supported auth method for
89
+ headless agent use; if you skip the key the daemon falls back to the
90
+ CLI's local subscription login, which most providers do not
91
+ officially support — Anthropic in particular currently prohibits the
92
+ Claude Agent SDK on a Claude Pro / Max subscription. The dashboard
93
+ surfaces a warning whenever a backend is on subscription auth.
94
+
95
+ Cloud providers (Bedrock / Vertex / Foundry / Azure OpenAI /
96
+ Gemini-Vertex) let teams reuse an existing enterprise contract,
97
+ keep model traffic inside a private VPC, or take advantage of
98
+ provider-side rate-limit pools. Aitne stores the credentials in the
99
+ OS keychain and mirrors the corresponding env vars
100
+ (`CLAUDE_CODE_USE_BEDROCK=1`, `CLAUDE_CODE_USE_VERTEX=1`,
101
+ `CLAUDE_CODE_USE_FOUNDRY=1`, `GOOGLE_GENAI_USE_VERTEXAI=true`, …)
102
+ into the backend subprocess. See
103
+ [Use cloud providers](../guides/use-cloud-providers.md) for the
104
+ end-to-end walkthrough and
105
+ [Costs and Quotas](costs-and-quotas.md) for the cost shape of each
106
+ path.
71
107
 
72
108
  ## Why This Concept Exists
73
109
 
@@ -7,12 +7,11 @@ aliases:
7
7
  - cost
8
8
  - budget
9
9
  - quota
10
- - subscription limit
11
10
  category: concepts
12
11
  summary: |
13
- How Aitne meters subscription windows and per-call costs,
14
- and where the operator sees the rollup. Cost tracking is
15
- observational — the dashboard reports, it does not bill.
12
+ How Aitne meters per-call costs and provider quotas, and where the
13
+ operator sees the rollup. Cost tracking is observational — the
14
+ dashboard reports, it does not bill.
16
15
  section: cost
17
16
  tags:
18
17
  - cost
@@ -21,24 +20,27 @@ tags:
21
20
  status: stable
22
21
  ask_examples:
23
22
  - How do I see how much my agent is spending?
24
- - When do my Opus tokens reset?
25
- - Why is the agent saying "subscription limit reached"?
23
+ - Why did the agent fail over from Claude to Codex?
24
+ - What does the autonomous daily cost cap do?
26
25
  locale: en-US
27
26
  created: 2026-04-25
28
- updated: 2026-04-25
27
+ updated: 2026-05-04
29
28
  keywords:
30
29
  - cost
31
30
  - budget
32
31
  - quota
33
- - max5
34
- - max20
35
- - opus window
32
+ - api quota
33
+ - per-token billing
36
34
  - gemini quota
35
+ - subscription fallback
37
36
  related:
38
37
  - concepts/backends-and-tiers
38
+ - concepts/auth-health
39
39
  - features/operations/cost-tracking
40
+ - guides/use-cloud-providers
40
41
  ui_anchors:
41
42
  - /analytics
43
+ - /settings/models
42
44
  config_keys:
43
45
  - autonomousDailyCostCapUsd
44
46
  ---
@@ -47,13 +49,22 @@ config_keys:
47
49
 
48
50
  ## TL;DR
49
51
 
50
- Each backend bills differently:
52
+ Aitne is designed to run on **provider API keys** registered in the
53
+ dashboard. With keys configured, every backend bills per-token /
54
+ per-call against your provider account:
51
55
 
52
- - **Claude Code** — flat-rate inside `Claude Max5` / `Max20` with a
53
- rolling 5-hour Opus window.
54
- - **Codex** — flat-rate inside `Codex Pro`.
55
- - **Gemini** — per-token billed against the Google API quota; free tier
56
- has per-day caps.
56
+ - **Claude (via Claude Code)** — per-token billing on
57
+ `ANTHROPIC_API_KEY`.
58
+ - **Codex (via Codex CLI)** — per-token billing on `OPENAI_API_KEY`.
59
+ - **Gemini (via Gemini CLI)** — per-token billing on `GEMINI_API_KEY`
60
+ / `GOOGLE_API_KEY`; the free tier has per-day caps.
61
+
62
+ If you skip the API key, the daemon falls back to whatever
63
+ subscription auth the CLI already has on your machine. That fallback
64
+ is not provider-supported for automated agent use — see
65
+ [Authentication policy](#authentication-policy) below — and the cost
66
+ shape becomes whatever the underlying subscription enforces (e.g.
67
+ Claude's rolling 5-hour Opus window when running on a Max plan login).
57
68
 
58
69
  The dashboard rolls cost up by ProcessKey, by backend, and by agent day.
59
70
 
@@ -68,11 +79,48 @@ The autonomous daily-cost cap (`autonomousDailyCostCapUsd`) is a
68
79
  bumper, not a budget — it pauses autonomous routines when crossed but
69
80
  does not interrupt reactive (in-the-loop) traffic.
70
81
 
82
+ ## Authentication policy
83
+
84
+ **Provider API keys are the recommended way to run Aitne.** The
85
+ daemon exposes only one auth-config surface — the per-backend API
86
+ key picker on `/settings/models` — and treats whatever
87
+ *subscription* login the matching CLI happens to have on your
88
+ machine purely as a fallback when no key is registered.
89
+
90
+ Concretely:
91
+
92
+ - **Subscription-plan registration has been removed.** The setup
93
+ wizard and `/settings/models` no longer ask the operator which
94
+ subscription tier they hold; the DB no longer stores plan state;
95
+ the router never branches on plan.
96
+ - **API key first.** When a key is registered (direct or one of the
97
+ cloud-provider options — Bedrock / Vertex / Foundry / Azure
98
+ OpenAI / Gemini-Vertex), Aitne mirrors the corresponding env vars
99
+ into the backend subprocess and bills per-token / per-call
100
+ against your provider account.
101
+ - **Subscription is fallback only.** If you skip the key, the
102
+ daemon runs against whatever local CLI login is present
103
+ (`claude`, `codex login`, `gemini auth`). The dashboard surfaces
104
+ a `SubscriptionAuthWarning` banner whenever any backend is on
105
+ this path because most provider policies for headless /
106
+ programmatic agents do not extend to personal subscriptions —
107
+ **Anthropic currently prohibits using the Claude Agent SDK with a
108
+ Claude Pro / Max subscription**.
109
+
110
+ If you see the warning banner, the recommended action is to
111
+ register an API key on `/settings/models`.
112
+
71
113
  ## Definitions
72
114
 
73
- - **Subscription window**: Claude Max plans have a rolling 5-hour
74
- budget for Opus + a separate Sonnet bucket. The dashboard shows
75
- remaining quota and the next reset time.
115
+ - **API key**: per-backend secret stored in the OS keychain (or
116
+ inherited from your shell env) the daemon's preferred auth
117
+ method. Mirrored into the SDK / CLI subprocess via
118
+ `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / `GEMINI_API_KEY` /
119
+ `GOOGLE_API_KEY`.
120
+ - **Subscription fallback**: the CLI's local login (`claude`,
121
+ `codex login`, `gemini auth`). Used only when no API key is
122
+ configured. Cost behaviour then matches whatever the subscription
123
+ enforces (e.g. Claude's rolling 5-hour Opus window on a Max plan).
76
124
  - **Daily cost cap**: `autonomousDailyCostCapUsd` — autonomous routines
77
125
  pause on the day they cross it. Reactive DMs / dashboard chat keep
78
126
  running; you can always reach the agent.
@@ -83,18 +131,32 @@ does not interrupt reactive (in-the-loop) traffic.
83
131
 
84
132
  ## Concrete Examples
85
133
 
86
- - Morning routine on Opus / Max20 = "no extra charge", but eats the
87
- rolling 5-hour window.
88
- - Morning routine on Sonnet / Max5 = covered by the Sonnet bucket
89
- (fast resets), Opus window untouched.
90
- - A Gemini hourly check on Flash / API tier = ~$0.0005 per fire.
134
+ - Morning routine on Sonnet via `ANTHROPIC_API_KEY` = per-token
135
+ billing against your Anthropic account, typical cost a few cents.
136
+ Since 2026-05, a lite-tier `routine.fetch_window` pre-pass (Haiku)
137
+ fetches mail / calendar / Notion windows ahead of the main session,
138
+ trimming the main Sonnet input from ~35k tokens to ~18k (~24% total
139
+ cost reduction per fire).
140
+ - Morning routine on Opus via `ANTHROPIC_API_KEY` = per-token billing
141
+ on the Opus rate; pin only when Sonnet has failed the task. **No
142
+ recurring routine seeds on Opus by default** — only the one-shot
143
+ `routine.morning_routine_initial` runs heavy out of the box.
144
+ - Gemini hourly check on Flash via `GEMINI_API_KEY` = ~$0.0005 per
145
+ fire on the paid tier; free tier instead consumes a per-day quota
146
+ slot.
147
+ - Claude Code without an API key (subscription fallback on a Max20
148
+ login) = covered by the subscription, but the daemon flags the
149
+ fallback because it falls outside Anthropic's published policy.
91
150
 
92
151
  ## Where You See It in the Dashboard
93
152
 
94
153
  - **Analytics** rolls today's cost by backend, by ProcessKey, and by
95
- hour. Window-remaining math is here too.
154
+ hour. When a backend is running on the subscription fallback,
155
+ remaining-window math is shown there too.
96
156
  - **Sidebar footer** shows the day's running total.
97
157
  - **Activity** event details include the per-execute cost.
158
+ - **Settings → Models** exposes the per-backend API-key panel and a
159
+ warning banner whenever a backend is running on subscription auth.
98
160
 
99
161
  ## Related
100
162
 
@@ -17,9 +17,7 @@ summary: |
17
17
  the agent reaches the integration through one of two paths depending
18
18
  on whether its DM session backend matches the connector's owner —
19
19
  same-backend (native MCP, no daemon involved) or cross-backend
20
- (`/api/integrations/:key/exec` task mode: the agent describes intent
21
- in natural language and the daemon's delegate picks the connector
22
- tool).
20
+ (`/api/integrations/:key/invoke` proxy).
23
21
  section: integrations
24
22
  tags:
25
23
  - core
@@ -65,7 +63,7 @@ Each integration is in one of three modes:
65
63
  | Mode | Who holds credentials | What the agent calls |
66
64
  |---|---|---|
67
65
  | `direct` | Daemon (OAuth in macOS Keychain) | `curl /api/mail/*` / `curl /api/calendar/*` |
68
- | `delegated` | The agent's backend connector (claude.ai / ChatGPT / Google) | Native MCP tools or the `/api/integrations/:key/exec` task endpoint |
66
+ | `delegated` | The agent's backend connector (claude.ai / ChatGPT / Google) | Native MCP tools or the `/api/integrations/:key/invoke` proxy |
69
67
  | `disabled` | Nobody | Nothing — the integration is off |
70
68
 
71
69
  Under `delegated`, two sub-cases exist depending on whether the DM session's
@@ -74,12 +72,9 @@ backend is the same as the integration's `delegatedBackend`:
74
72
  - **Same-backend** — DM agent calls the connector's MCP tool directly.
75
73
  The daemon is not involved. No skill body is materialized.
76
74
  - **Cross-backend** — DM agent calls
77
- `POST /api/integrations/:key/exec {task, outputSchema, …}` with a
78
- natural-language `task`. The daemon spawns a one-shot subprocess of
79
- `delegatedBackend`, lets it pick the right MCP tool against the
80
- per-task allowed-tools envelope, validates the JSON, and returns it.
81
- (Earlier versions of this concept used an RPC `{tool, args}` shape
82
- at `/invoke`; that route is retired — see DELEGATED-TASK-MODE-DESIGN.md.)
75
+ `POST /api/integrations/:key/invoke {tool, args}`. The daemon spawns
76
+ a one-shot subprocess of `delegatedBackend`, runs the tool there,
77
+ and returns the raw result.
83
78
 
84
79
  ## Why This Concept Exists
85
80
 
@@ -115,8 +110,7 @@ that case the daemon spawns the other backend per call.
115
110
  describes its own tools at session-init.
116
111
  - **Cross-backend** — DM session backend differs from `delegatedBackend`.
117
112
  The agent reaches the integration through
118
- `POST /api/integrations/:key/exec` (task mode natural-language
119
- `task` + JSON `outputSchema`) and the daemon spawns
113
+ `POST /api/integrations/:key/invoke` and the daemon spawns
120
114
  `delegatedBackend` as a subprocess for each call. A
121
115
  `SKILL.delegated.<sessionBackend>.md` file is materialized into the
122
116
  session workdir.
@@ -148,7 +142,7 @@ When you pick `delegated`, also pick `delegatedBackend`:
148
142
  |---|---|
149
143
  | Gmail direct | Agent: `curl /api/mail/<acct>/messages?q=...` → daemon hits Gmail API with stored OAuth |
150
144
  | Gmail delegated to Codex × Codex DM (same-backend) | Agent: `mcp__codex_apps__gmail._search_emails(...)` → Codex's connector hits Gmail. No daemon involvement. No skill file. |
151
- | Gmail delegated to Codex × Claude DM (cross-backend) | Agent: `curl -X POST /api/integrations/gmail/exec -d '{"task":"Search Gmail for…","outputSchema":{...},"cacheable":true}'` → daemon spawns Codex subprocess Codex picks the right MCP primitive (e.g. `_search_emails`)daemon validates the JSON against the schema and returns it |
145
+ | Gmail delegated to Codex × Claude DM (cross-backend) | Agent: `curl -X POST /api/integrations/gmail/invoke -d '{"tool":"search_emails","args":{...}}'` → daemon spawns Codex subprocess with `proxy.md` profile Codex calls `mcp__codex_apps__gmail._search_emails` → returns raw result through daemon |
152
146
 
153
147
  ## How the Skill File Resolves
154
148
 
@@ -25,7 +25,7 @@ ask_examples:
25
25
  - What is the difference between context MD and SQLite?
26
26
  locale: en-US
27
27
  created: 2026-04-25
28
- updated: 2026-04-25
28
+ updated: 2026-05-04
29
29
  keywords:
30
30
  - context
31
31
  - markdown
@@ -33,6 +33,8 @@ keywords:
33
33
  - today.md
34
34
  - user/profile.md
35
35
  - roadmap.md
36
+ - rules/management.md
37
+ - rules/policies
36
38
  related:
37
39
  - features/memory-files/today
38
40
  - features/memory-files/user-profile
@@ -40,6 +42,7 @@ related:
40
42
  - features/memory-files/agent-journal
41
43
  - features/memory-files/schedule
42
44
  - features/memory-files/projects
45
+ - features/memory-files/management-rules
43
46
  ui_anchors:
44
47
  - /knowledge
45
48
  - /connections/knowledge
@@ -50,6 +53,9 @@ context_files:
50
53
  - agent/journal.md
51
54
  - daily/<date>.md
52
55
  - projects/<slug>.md
56
+ - rules/management.md
57
+ - rules/policies/<slug>.md
58
+ - rules/policies/_index.md
53
59
  ---
54
60
 
55
61
  # Memory Model
@@ -101,6 +107,13 @@ indexes, and configuration.
101
107
  - `daily/2026-04-25.md` — per-date archive of that day's plan,
102
108
  synthesized by the morning routine.
103
109
  - `projects/<slug>.md` — one file per active project.
110
+ - `rules/management.md` — the umbrella registry: Source-of-Truth
111
+ bindings, Managed Tasks, an Active Policies summary. Always
112
+ injected into every flow. See
113
+ [rules/management.md and rules/policies/](../features/memory-files/management-rules.md).
114
+ - `rules/policies/<slug>.md` — one file per durable management rule
115
+ ("from now on, do X"). The daemon auto-maintains a slug index at
116
+ `rules/policies/_index.md`.
104
117
 
105
118
  ## Where You See It in the Dashboard
106
119