A research agent finishes its assignment. Its credential still exists. Weeks later, another process presents that credential to a shared memory API. What should happen?
Issuing access is only the beginning of a credential's lifecycle. A memory system also needs to define when that access ends, how a replacement is issued and what information remains beyond its control.
In the accepted MB-001 foundation of METABOLIQ Brain, agent credentials carry an owner identity, namespace and operation grants, a sensitivity ceiling and, for newly issued credentials, an expiry time. Revocation and rotation change whether the old credential may authenticate subsequent requests.
The boundary is precise: ending future access does not erase information already received, and it does not automatically cancel a request that has already authenticated. We tested that distinction rather than assuming that revocation means instant cancellation.
The foundation discussed here is accepted for one owner on a trusted local machine. Newer retrieval experiments are outside this article's scope.
A token is not unlimited authority
When a bearer credential is presented, the API looks up the credential, compares its stored hash with the presented token's hash, and checks its revocation and expiry state. It then constructs an authenticated principal with the credential's owner, agent identifier, grants and sensitivity ceiling.
A bearer header selects agent authentication even when an owner-session cookie is present. Request fields cannot turn that agent into the owner.
Authentication and permission to read a particular memory are separate checks. A valid token may still lack a namespace grant, the required operation or a sufficient sensitivity ceiling. Agents also remain subject to the active-memory restriction described in Article 002.
Read and write grants are distinct. Updating an existing record requires both; a write-only grant does not authorize learning the existing text through an update response.
Expiry is a server-side check
Newly issued agent credentials default to a 90-day lifetime and an internal sensitivity ceiling. The API accepts lifetimes from 1 to 365 days. These defaults are operational choices in this foundation, not a general recommendation for every deployment.
Expiry is checked during authentication rather than relying on a console status label. We froze the authentication clock and tested credentials whose expiry was one microsecond before, exactly at and one microsecond after that time. Before and equal were rejected; the just-after case authenticated.
The equality case matters: the implemented comparison treats a credential as expired when its expiry time is less than or equal to the authentication time.
A last-used timestamp may be refreshed at most once per minute, but that optimization does not turn authentication into a minute-long credential cache. The accepted authentication path reads credential state for each new request.
Rotation replaces a secret and preserves permissions
Owner-triggered rotation creates a replacement credential with a new identifier and token, then revokes the old credential in the same transaction. It preserves the name, namespace grants, operation grants and sensitivity ceiling.
The replacement receives a fresh lifetime: 90 days by default, with the same 1-to-365-day API bounds. It does not simply inherit the old expiry timestamp.
| Property | Replacement behavior |
|---|---|
| Credential identifier and full token | New values |
| Old credential | Marked revoked |
| Name, namespace grants and operations | Preserved |
| Sensitivity ceiling | Preserved |
| Expiry | Fresh bounded lifetime |
Our focused verification used a Work-scoped credential with read/write grants and a secret sensitivity ceiling. After rotation, the replacement retained that ceiling and those operations. It could retrieve the permitted Work record and submit an edit, while a Personal record remained inaccessible. The old token was rejected.
Rotation is therefore a credential replacement operation, not a permission-reduction workflow. Narrowing access requires an explicit permission decision; it should not be inferred from the fact that a token is new.
Legacy credentials need separate attention
Defaults for new credentials do not describe every existing credential. The accepted hardening migration added expiry and sensitivity fields while preserving legacy reach: existing credentials received no expiry timestamp and a secret ceiling.
We verified that behavior by creating a fictional credential in the earlier database schema and applying the accepted migration. Its token hash and grant survived, its expiry remained unset and its ceiling became secret.
Rotating a credential in that legacy-compatible state gave its replacement a fresh expiry, but preserved the secret ceiling. It did not pick up the internal ceiling used when creating a new credential without an explicit ceiling.
That distinction is easy to miss in an overview. A security default is only useful if we also explain what happens to credentials that predate it.
Replacement and revocation must commit together
A failed rotation should not leave the old credential revoked without a usable replacement, or commit an unexpected extra credential. The accepted rotation service performs issuance, grants, old-credential revocation and successful lifecycle audit writes within one transaction.
We injected failures at three points: replacement credential insertion, audit insertion and the update marking the old credential revoked. In all three cases, rollback left credential, grant and audit row counts unchanged. The old credential remained active and could still authenticate.
These are controlled transaction-failure checks. They do not establish behavior under every crash, network failure or client retry. A successful commit followed by a lost response is a different operational problem from a transaction that never commits.
Revocation is not in-flight cancellation
To test the boundary, we paused an agent read after authentication had produced its principal but before the memory service returned the record. The owner then revoked the credential. When we released the paused read, it completed successfully. A subsequent read with that credential returned 401.
We repeated the controlled pattern for rotation and for expiry. In each case, the already authenticated read could finish, while the following request with the old or expired credential was rejected.
This result reflects where the check occurs. Credential state is checked while constructing the request's principal; this tested read path does not reauthenticate the token immediately before returning content.
The finding supports a narrow statement about these controlled reads. It is not a claim about every possible request interleaving, write operation or streaming connection. The accepted foundation does not provide a general mechanism for recalling information already delivered to an agent.
The same limit applies outside the API. Revoking a token cannot delete downstream copies, an agent's saved output or information already placed in another system.
The secret should not be the audit record
Issuance and rotation responses return the full token so the caller can save it. Later credential listings expose metadata and a lookup prefix, not the full token. The credential table stores a one-way hash of the full token.
Audit entries can record lifecycle actions, credential identifiers, a prefix, grants, ceiling and expiry information without storing the bearer secret itself.
Our focused checks confirmed that the full test token was absent from the credential row representation, later listing, revoked-token error response, stored audit rows and captured test logs. Existing audit regressions also checked that credentials and memory payload markers were excluded from audit data.
That evidence is scoped to the inspected application paths and tests. It does not certify an external proxy, monitoring service, caller's terminal or an agent's own logs. The caller still has to protect the token returned at issuance.
What we tested—and what remains
We ran all 123 tests in the accepted backend suite; all passed. We also ran 16 focused editorial cases: three exact expiry-boundary cases, four rotation-lifetime boundary cases, one nondefault-permission rotation case, three rollback cases, three already-authenticated read scenarios, one token-exposure check and one real legacy-schema migration check. All passed.
The focused checks ran as 15 lifecycle cases followed by the additional migration case. Testing used Python 3.12, PostgreSQL 17 and fictional records in a separate accepted-source snapshot. No real credentials, existing memory databases or active Brain development files were changed.
This was backend verification, not a frontend/browser acceptance run, production penetration test or assessment of every deployment log. The accepted scope remains one owner on a trusted local machine, with TLS, tested backups and further operational controls needed for broader use.
The engineering lesson
A credential lifecycle needs to answer several different questions: can this token authenticate now, what may its principal access, what permissions will a replacement retain, and what happens to work already underway?
Expiry and revocation end future authentication under the conditions checked by the service. Rotation replaces a secret while retaining its configured authority. None of those operations can make an agent forget information it has already received.
Those boundaries are part of the implementation's contract. Making them visible helps us evaluate the system we have built and identify the controls a wider deployment would still require.
← All engineering articles