interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / docs / plans / aien-personalization / CONTRACT-v1.md

85 lines · 8116 bytes Raw Blame History Rendered
1# Aien persona profile contract v1 (`aien.allen.profile/1`)
2
3Part of the finite workstream in `README.md` (not a master plan). Issue: aien-spark/aien-architecture#159. This is a proposed contract for review. It is not an accepted ADR, freezes no native format, and the SubjectState ([aienux docs/adr/0018-allen-subject-state-object.md](https://github.com/aien-dev/aienux/blob/9e0e6179140e9571a95f19a1b707ac576e16c859/docs/adr/0018-allen-subject-state-object.md), kind 24) is not changed by it. The implementation is the **sovereign-core persona profile PR (pending)**; where this text and that code differ, the code is the evidence and the difference is a bug in one of them.
4
5## 1. Ownership
6
7| Concept | Owner | Stored where | Never |
8|---|---|---|---|
9| Identity | Aienux provisions; host `aien-allen` resolves (read only; rename to `aien-subject` planned) | SubjectState kind 24 in the Aienux Store, host pin `<home>.allen-binding` (rename to `<home>.aien-binding` planned) | Created or edited by host or frontend code. A display name is not identity. |
10| Persona profile | Host crate `aien-allen-profile` (ships on sovereign-core main) is the only writer (rename to `aien-subject-profile` planned) | `<home>.allen-profile/` beside the binding file (rename to `<home>.aien-profile/` planned) | A second copy that claims to be current. Caches carry the revision and refuse identity mismatch. |
11| Working preferences | Same profile record | Same store | Treated as permissions or as facts from model output. |
12| Standing intent | Aienux (SubjectState) | Subject intents (v0: `GOAL_LATENCY` only) | Written by the profile. Not covered by v1 (see AUDIT-v1). |
13| Memory | Cortex (ARCH-0022) | Cortex journal | Duplicated into the profile. The profile holds no memory content. |
14| Permissions | Approval desk and capability authority (S4 `authorize`, Aienux) | Their own records | Granted by profile text. |
15| User account/session | Not defined in v1 | n/a | Interchangeable with the logical agent id. One local operator per compose home. |
16
17One subject per configured root. Multi-subject, multi-device sync, clone and fork are out of scope and refused, not implied.
18
19## 2. Schema `aien.allen.profile/1`
20
21One JSON object per revision file, at most 16 KiB, parsed with unknown fields denied.
22
23| Field | Type and limit |
24|---|---|
25| `schema` | exactly `"aien.allen.profile/1"` (rename to `"aien.subject.profile/1"` planned) |
26| `agent` | 64 hex chars, the resolved LogicalAgentId |
27| `root` | 64 hex chars, the resolved AgentRoot |
28| `revision` | integer, starts at 1, increases by exactly 1 |
29| `prev_sha256` | hex sha256 of the previous revision file bytes; all zeros for revision 1 |
30| `written_at` | UTC string, informational only, never used for ordering |
31| `author` | `"user"`, `"reset"` or `"revert:N"` |
32| `note` | at most 200 characters |
33| `persona.display_name` | 1 to 64 characters after trimming, no control characters |
34| `persona.tone` | `neutral`, `warm`, `direct` or `formal` |
35| `persona.verbosity` | `brief`, `normal` or `detailed` |
36| `persona.plain_language` | boolean |
37| `working_preferences` | at most 32 entries: `key` matching `^[a-z0-9_.-]{1,48}$`, `value` at most 200 characters, `scope` one of `all`, `personal`, `work`, `project`, `provenance` exactly `"user_explicit"` |
38
39Preference keys containing `grant`, `permission`, `approve`, `capability`, `allow` or `authori` are rejected with the reason "permissions are not profile fields; approvals go through the approval desk". No avatar, voice, memory or credential fields exist in v1. Status reports avatar and voice as unsupported. Defaults when no profile exists: display name `Aien`, tone `neutral`, verbosity `normal`, plain_language false, no preferences.
40
41## 3. Revisions, crash safety, concurrency
42
431. The store is immutable revision files `r00000000000000000001.json`, `r...2.json`, and so on. Nothing is edited in place.
442. A write goes: temp file, write, fsync, hard link temp to `rN` (fails if `rN` exists, which means another writer won, reported as StaleUpdate), fsync the directory, remove the temp file. A crash leaves the old head or the new head, never a mix. Leftover temp files are ignored.
453. The head is the highest N with a valid contiguous chain 1..N, each `prev_sha256` matching the previous file's bytes.
464. Every change names the revision it expects (`--expect R`, compare-and-swap). A mismatch is StaleUpdate and changes nothing. With concurrent writers exactly one wins.
475. Undo is revert: a new revision that copies an earlier one (`author: "revert:N"`). Reset is a new revision with defaults (`author: "reset"`). Neither touches identity or deletes history.
486. A damaged, foreign, or unknown-schema file is a clear refusal. It is never silently replaced and never causes a new subject to be created.
49
50## 4. Refusal list
51
52The writer refuses: profile with no engaged identity; `agent` or `root` different from the resolved identity (ForeignProfile); stale `--expect`; malformed JSON; unknown schema; unknown field; file over 16 KiB; any field over its limit; a permission-looking preference key; a broken or gapped revision chain. Model output has no code path to the writer.
53
54## 5. Precedence
55
561. The current instruction (goal text of the request) wins over any saved preference.
572. Saved preferences are style choices only. They rank below project constraints and below authoritative permissions.
583. Permissions never come from the profile. A write still needs S4 `authorize` and S5 `execute` whatever the profile says.
594. Retrieved or external content is untrusted and cannot change the profile.
60
61## 6. Enforced versus advisory
62
63| Item | Class | Mechanism |
64|---|---|---|
65| Identity binding of the profile (agent and root equal the resolved identity) | Enforced | Checked on every read and write. |
66| Schema, limits, revision chain, compare-and-swap | Enforced | Writer code and tests. |
67| No permission grant from profile | Enforced | Key rejection plus authorization unchanged at its own boundary. |
68| Display name in reports | Enforced (report field) | `ComposeTaskReport` carries persona state, name and revision. |
69| Tone, verbosity, preferences shaping model text | Advisory | A bounded block (at most 2048 bytes, preferences sorted by key, overflow dropped and counted) in the prompt. A model may ignore it. Real-model effect is NOT_RUN. |
70
71## 7. Migration
72
73A reader accepts exactly `aien.allen.profile/1`. Any other schema value is refused with a clear message. A future v2 needs an explicit migrator that reads a v1 chain and writes a new revision in the v2 form, never an in-place rewrite and never a silent upgrade on read. Sovereign-core main still ships that schema from crate `aien-allen-profile` under `<home>.allen-profile/`. A rename of the schema string to `aien.subject.profile/1` and of the store directory to `<home>.aien-profile/` is planned, not done; no daemon-start migrator ships on main.
74
75## 8. The nine issue invariants and how v1 keeps each
76
771. **LogicalAgentId and AgentRoot identify Aien.** The profile stores those two values and refuses a mismatch. No `AienId`.
782. **Display name is not identity or authorization.** It is a free field in `persona`; nothing keys on it.
793. **SubjectState independent of weights, KV, machine, queues.** SubjectState is untouched; the profile is a separate host record.
804. **Aien is not a planner, UI, scheduler or loop.** The profile is passive data read when a request is built.
815. **Cortex owns memory.** The profile has no memory fields and no journal copy.
826. **Aienux is the provisioning and capability authority.** Host code only attaches to an existing subject; permissions stay with the approval desk.
837. **Missing identity is not repaired by creating another.** Not engaged means profile commands refuse; nothing is minted.
848. **v0 has one subject per root and limited intent semantics.** v1 supports one subject per root and claims no general goals or multiple subjects.
859. **INTERPLANE is interface and transport.** v1 changes no INTERPLANE wire format; any presentation extension would be a separate, explicitly versioned contract.