No description
Find a file
2026-11-21 00:00:09 +00:00
.woodpecker Implement Attention foundation and authenticated identity (#10) 2026-11-15 08:57:51 +00:00
contracts Implement Attention foundation and authenticated identity (#10) 2026-11-15 08:57:51 +00:00
docs Clarify reviewed originals and public copies 2026-11-20 07:40:57 +11:00
proofs/recovery Record complete amended staging proof observations 2026-11-17 07:22:20 +11:00
src/attention_mind_mcp Reject ambiguous plus in listing credential echoes 2026-11-21 10:33:14 +11:00
tests Reject ambiguous plus in listing credential echoes 2026-11-21 10:33:14 +11:00
.gitignore Implement Attention foundation and authenticated identity (#10) 2026-11-15 08:57:51 +00:00
GLOSSARY.md docs: record accepted Attention product architecture and issue plan 2026-11-15 17:42:27 +11:00
pyproject.toml Add authenticated recovery envelopes and frontier validation 2026-11-20 14:02:35 +11:00
README.md Validate Host and refuse Origin at the HTTP boundary 2026-11-20 12:38:25 +11:00
uv.lock Add authenticated recovery envelopes and frontier validation 2026-11-20 14:02:35 +11:00

Attention Mind MCP

Standalone personal attention capability with a local SQLite queue, authenticated principal mappings and durable commands over authenticated MCP Streamable HTTP. Exactly nine tools are supported: attention_info_v1, attention_admit_v1, attention_submit_v1, attention_replace_v1, attention_withdraw_v1, attention_dispose_v1, attention_list_v1, attention_get_v1 and attention_explain_v1.

Status: bounded queries and ranking (slice 3/6). Fresh valid queues and recognized clean foundation migrations are ready for the implemented operations. Persistent recovery fences and unresolved prepared transitions quarantine the queue across restart. Full provider conformance, packaged performance and deployment acceptance remain unproven.

Blades expose a system's capabilities; minds maintain durable domain knowledge over time. See ADR 0001, the product decision, the domain glossary and the six implementation slices. The host owns interruption policy; in Stallari, Signals retains that authority. One personal queue has one selected authority. An external binding does not grant authority or implement native Stallari support.

Immutable specification

The implementation input is dev/mind-spec at 3da6a263e6aeb3f37d25590d6ab755045ff53786:

Four byte-identical resources are force-included in the wheel's _attention_mind_mcp_contracts resource namespace and loaded using importlib.resources. There is no checkout/cwd fallback or network schema resolution. Loading refuses a hash mismatch. contract.py records the pin and these SHA-256 values:

Source resource SHA-256
contracts/attention-v1/schema.json 60f0984ff1a404f51435f2aefdd380dcc8e94600cff7765ea953c98d14ebdbb5
contracts/attention-v1/requests.schema.json 14f1b98437a483c5fbc43fb35219f910a278143927538d67279d8ee4148b44e5
contracts/attention-v1/types.schema.json 5899a021d2d7dca586e99cf171948cd8350ed10522ba05be6e1078ebb444598b
profiles/connectivity/binding-1.1.schema.json f36783a5e49f7ea133a136b7ac2db7e4cbad421ddfbfd518b056053a7ab9fc5b

The binding schema is vendored under contracts/connectivity/ without altering its bytes or $id. The immutable mind-spec-v0.1.0 is the earlier Mail release, not an Attention release. The reference-model corpus is not used as this provider or certified by these provider tests.

Local setup and identity

Python 3.12 or newer and uv are required. Dependencies are locked in uv.lock. For local work, keep environments, caches, credentials, databases, bindings and build outputs outside the checkout. .gitignore excludes common local artifacts. Disposable CI checkouts may use the ignored .venv and tool caches; synthetic credentials, databases and wheel-install targets still live in external temporary directories.

export UV_PROJECT_ENVIRONMENT="$(mktemp -d /tmp/attention-venv.XXXXXX)"
export UV_CACHE_DIR="$(mktemp -d /tmp/attention-cache.XXXXXX)"
export PYTHONDONTWRITEBYTECODE=1
export RUFF_CACHE_DIR="$(mktemp -d /tmp/attention-ruff.XXXXXX)"
export MYPY_CACHE_DIR="$(mktemp -d /tmp/attention-mypy.XXXXXX)"
uv sync --locked

Create a new queue once, provision a synthetic local credential, then serve it. Substitute local paths, and create the secret-file parent directory first:

uv run attention-mind init --data-dir /path/to/data
uv run attention-mind principal-provision --data-dir /path/to/data \
  --credential-file /path/to/secrets/client --generate
uv run attention-mind show --data-dir /path/to/data
uv run attention-mind serve --data-dir /path/to/data \
  --expected-queue-id UUID_FROM_INIT --host 127.0.0.1 --port 8765

init alone creates queue/recovery UUIDs and refuses reinitialisation. Ordinary migration, restart and offline administration preserve both, along with the queue secret, effective clock, limits and principal mappings. An uninitialised store cannot serve; a wrong provider queue pin refuses before listening. serve binds loopback by default; --host sets the bind address, not the allowlist. Authentication is required on loopback and behind existing ingress. Requests receive 421 unless their Host is localhost, 127.0.0.1, [::1], or a host named with the repeatable --allowed-host NAME option; the port is ignored. Operators must name the ingress hostname with this option, using brackets for IPv6 literals. The option is not stored with the queue. Every request carrying an Origin header receives 403, whatever its value. Both checks precede authentication; refusal bodies are fixed and repeat no header value. Browser clients and CORS are unsupported. No ingress installation is included.

Credentials are accepted only by file reference, never literal argv values, environment secrets or binding contents. --generate creates a new owner-only file exclusively and never overwrites it. Existing credential files must be bounded, nonempty owner-only regular files owned by the running user. SQLite stores SHA-256 digests, not credential text. Administration prints no token or digest.

Principal IDs are stable canonical UUIDs. principal-provision accepts --principal-id for an atomic mapping update, optional canonical UUID --namespace, local --host and repeated independent --grant submit|read|disposition|forget|delivery. Several principals may share a namespace. Zero-grant membership can inspect info. grant-set and grant-revoke take --principal-id and --grant. selected-host --host LABEL (or --clear) configures the selected delivery-host association. Submit, replace and withdraw require a submit grant and mapped namespace; replace and withdraw additionally require the retained item’s namespace owner. Disposition authority is independent of read and submit. Current mappings and grants are checked inside each serialized decision, including replay. Delivery predicates remain authority seams for future work.

Binding bootstrap and checked connection

Bootstrap is an explicit setup command. It authenticates unpinned info, validates the returned profile/identity/envelope, and exclusively writes a complete binding 1.1 with the discovered expected_queue_id. It never stores credentials or pins recovery generation:

uv run attention-mind binding-bootstrap --binding-file /path/to/binding.json \
  --binding-id local-attention --endpoint http://127.0.0.1:8765/mcp \
  --credential-file secrets/client
uv run attention-mind binding-check --binding-file /path/to/binding.json

Relative credential references resolve from the binding's directory. binding-check sends the expected queue pin, learns the current generation transiently, prints inspected status and exits nonzero with quarantined while the readiness gate is closed. Successful authenticated discovery/pinning is possible in quarantine; it confers no domain access. Normal checks never rewrite the binding or silently rebind after a mismatch/refusal. ExternalClient.inspect() separates status inspection from Inspection.require_domain_ready().

External configuration permits only the exact profile and mcp-streamable-http, a finite positive timeout at most 3600 seconds, and closed file-credential fields. HTTPS uses certificate verification. HTTP requires --allow-http except exact localhost, 127.0.0.1 and ::1. Userinfo, queries/fragments, invalid ports, whitespace/control characters and backslashes are refused. Redirects are refused without forwarding credentials. Native binding syntax can validate, but native execution is unsupported before credential or network I/O. No fallback provider selection exists.

Offline administration and durability

One process owns writer.lock for its entire lifetime. Every database CLI command, including show, uses that same nonblocking lock and refuses while the service runs. The lock file is stable and retained. This is local process exclusion, not remote-host fencing or an active-active design. Writable SQLite connections use WAL, synchronous=FULL, foreign keys and serialised transactions. Only the recognized clean version-1 foundation schema migrates to version 2 and becomes locally ready. Unknown or inconsistent migration state fails closed; versions newer than 2 refuse downgrade. Migration never releases an existing version-2 recovery or pending fence. Effective time uses integer microseconds, persists each advance, and cannot decrease across restart. Time injection exists only in private tests.

To revoke or rotate, stop the service first. These commands report completion only after the offline transaction commits:

uv run attention-mind principal-revoke --data-dir /path/to/data --principal-id PRINCIPAL_UUID
# Or rotate the same principal, preserving its namespace, host and grants:
uv run attention-mind principal-rotate --data-dir /path/to/data --principal-id PRINCIPAL_UUID \
  --credential-file /path/to/secrets/replacement --generate
# Restart the same data directory and queue pin, then retry the old credential: it must fail.

After rotation deliberately update the client's file reference or replace its local credential file offline, then reconnect. A failed administrative transaction is not completed revocation/rotation. No live admin socket is supported. A failed mapping write can leave a generated but unused credential file; remove that file locally before deliberately retrying setup.

Durable commands and bounds

admit issues an authenticated, self-contained seven-day window bound to queue, recovery generation, stable actor, current namespace and host, and mutation. Issuance allocates no command/item capacity and creates no window table. Multiple command UUIDs in one window are independent. Equivalent normalized requests replay the original minimal outcome; a changed request under the same scoped key gives command_mismatch. Expiry always precedes replay, including after restart and a backward wall clock. Credential rotation preserves actor scope while authentication rejects the old credential.

Submit creates one retained item per namespace/occurrence, revision 1 and open disposition. Replace, withdraw and dispose compare the expected revision; changed state increments revision and queue mutation once. Candidate defaults are priority: normal and references: []. Equivalent replacements/dispositions and repeated current-revision withdrawal are no-ops. Withdrawal is terminal; disposition can still change without reactivating an item. Replacement alone changes the content timestamp. Only the current candidate and disposition are retained, without payload histories. Success contains only item UUID, revision and changed flag.

Ordinary unexpired outcomes, including admitted precondition refusals, consume command_records; replay works at saturation. Capacity, authority and invalid/expired-token refusals allocate no command record. Expired ordinary outcomes can be reclaimed without evicting live outcomes. Retained item count/normalized UTF-8 bytes and lifetime admissions are enforced atomically. Withdrawal and settlement release no retained capacity. Every successful submit allocates a separate eventual suppression/Forget entitlement, bounded by lifetime admissions and unavailable to ordinary commands; it survives terminal changes and restart. Production suppression remains empty until the erasure slice.

Info reports derived readiness and backup_policy: {max_retention_days: 30, cleanup: not_configured}. A private evidence-requiring policy persists a declarative preparation and reserves capacity before returning quarantined. Pending state blocks all domain commands before replay, including unrelated submissions. Internal limits are 64 preparations, 1,048,576 total encoded bytes and 65,536 bytes per preparation; whole-queue fencing permits at most one new unresolved transition. Restart, expiry, local policy and administration cannot discard it. Only an internal verifier bound to that exact transition digest, queue and generation can authorize atomic finalization and payload removal. Production has no external evidence resolver, custody configuration, backup/restore or manual readiness release. Real recovery needs separate slice-4 acceptance; synthetic verifier tests establish only the local seam.

The six defaults below are configurable through init --limit-NAME (hyphenate the names). Delivery limits are declared but unused because delivery is unsupported. Packaged resource/performance measurements remain later work.

Declared limit Default
item_count 10,000
item_bytes 67,108,864
lifetime_admissions 1,000,000
command_records 100,000
pending_delivery_count 1,000
pending_delivery_bytes 8,388,608

Transport refusals use fixed diagnostics misdirected_request (421) and origin_refused (403). Logical requests are capped at 16 KiB, logical results at 1 MiB, raw incoming HTTP bodies at 64 KiB, JSON nesting at 32, and active boundary requests at 16. List pages are sized on the full MCP envelope. A 30-second deadline bounds awaited transport work, including receiving requests and waiting for the release gate; it does not cancel synchronous store work. The external client caps decoded MCP envelopes at 2,162,688 bytes, requests identity encoding and refuses compression before decoding, and applies its configured timeout to the whole handshake. Ambiguous JSON, nonfinite numbers, invalid UTF-8/surrogates and unknown operation fields fail with fixed diagnostics. MCP results require structured content, consistent isError and identical single-text fallback when supplied.

The other five operations are unsupported: forget, delivery_request, delivery_begin, delivery_receipt, delivery_suppress. Authorized admissions for unimplemented mutations return unsupported_operation without allocating a window. No future tool stubs, source ingestion, source credentials, native adapter or delivery effect is present. Full conformance, S3 backup custody/recovery/Forget, Compose packaging, deployment and measured performance acceptance remain later work.

Queries

list, get and explain require the independent read grant. Ranking is priority high → normal → low, then dated before undated with due time ascending, then first acceptance ascending, then item UUID ascending. Replacement preserves first acceptance. Snooze expires inclusively at its exact microsecond. Explain reports only the fixed ranking inputs and applicable state reason codes.

List defaults to the eligible view and 50 rows, with a 100-row maximum. The all view includes withdrawn, handled, dismissed and snoozed items. Get and explain are not view-filtered. Authenticated stateless continuations bind actor, queue, recovery generation, view, limit, mutation generation and frozen evaluation time, with one five-minute deadline from the first page. Unknown or incompatible cursors and changed views return view_changed; expiry returns view_expired. No-op writes and passive time preserve the frozen view. No payload snapshot is retained. Pages fit the actual encoded MCP envelope (2,093,056 bytes), make progress and stay below the 1 MiB logical and 2,162,688-byte raw response ceilings.

The transport buffers protected responses after serialization, then rechecks current authority, read grant, queue/generation, quarantine and erasure immediately before handoff. The release gate serializes that recheck and handoff against served writers; handoff waits are capped at five seconds. Offline administrative writers are excluded while serving by the writer guard. The default live-items fence requires every released item to remain present; a private erasure-fence interface is reserved for the Forget slice. Tests cover revocation and deletion through private controls; the real Forget race remains #6/#8 evidence.

Every list page synchronously scans at most the configured item_count, extracts narrow ranking fields using SQLite JSON functions, sorts in O(N log N), and decodes payloads for at most the requested page. Continuations repeat that work. Get and explain read one row. Synchronous Python/SQLite work blocks the event loop and is not cancelled by a transport deadline, client timeout or disconnect. Packaged latency, memory and concurrency measurements remain #8 acceptance. Reads never acknowledge, dispose or deliver items, or advance mutation generation.

Validation and CI status

Run these exact checks after locked installation, with external environment/cache paths as above:

uv run python3 -m pytest -m unit -q
uv run python3 -m pytest -m transport -q
uv run ruff check .
uv run ruff format --check .
uv run mypy src

Strict pytest markers separate unit evidence from actual subprocess HTTP/MCP sessions; their counts must sum to the total collected count across all test files. Transport checks include real authenticated MCP sessions, concurrent clients and barrier-controlled termination of the actual writer before commit, after commit and before response. Unit tests cover domain/storage behavior; injected verifier evidence is synthetic and establishes no S3 or full-provider conformance. Tests use only synthetic credentials and external temporary data and reap child processes. The unit suite builds a local wheel, installs it into an isolated temporary environment using locked requirements, denies checkout file access and loads all four hash-checked resources and validators outside the checkout. This local build is not distribution.

Host measurements on 2026-11-15 with Python 3.14.5 passed 336 unit/installed-wheel tests in 23.39 seconds and 58 real HTTP/MCP tests in 129.03 seconds: 394 collected tests in total, each with exactly one evidence marker. The pristine dispatch baseline passed 255 unit and 40 transport tests. Ruff lint/format, strict mypy and uv build --out-dir /private/tmp/attention-svd-build-96e56214 passed. Build outputs stayed outside the checkout; no distribution was published. These host test timings do not establish packaged performance acceptance.

The architect-owned .woodpecker/validation.yaml runs locked dependency installation, quality checks, unit/installed-wheel tests and real HTTP transport tests in separate steps for pull requests and main pushes. It uses pinned Python/clone images and no secrets. Woodpecker repository activation and pull-request runs were enabled on 2026-11-15. CI acceptance requires a successful validation workflow for the current PR head; inspect its ci/woodpecker/pr/validation check for execution evidence. Required-check enforcement is separate from a successful run. Architect readback on 2026-11-15 found main protected=false, enable_status_check=false, contexts=[]; listing admin branch protections was denied to the writer. Coding completion references #5; it does not complete the issue's CI and combined-head gates or close parent #1.

Licence

No LICENSE file exists yet. The sibling minds are MIT; settle and record this repository's licence before distributing implementation code.