cortexdb-cli 0.5.4__tar.gz → 0.7.0__tar.gz

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 (58) hide show
  1. cortexdb_cli-0.7.0/PKG-INFO +378 -0
  2. cortexdb_cli-0.7.0/README.md +346 -0
  3. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/__init__.py +3 -3
  4. cortexdb_cli-0.7.0/cortexdb_cli/client.py +195 -0
  5. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/__init__.py +1 -1
  6. cortexdb_cli-0.7.0/cortexdb_cli/commands/access.py +849 -0
  7. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/admin.py +80 -14
  8. cortexdb_cli-0.7.0/cortexdb_cli/commands/admin_access.py +248 -0
  9. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/answer.py +13 -5
  10. cortexdb_cli-0.7.0/cortexdb_cli/commands/apps.py +129 -0
  11. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/audit.py +3 -0
  12. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/auth.py +15 -27
  13. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/beliefs.py +68 -9
  14. cortexdb_cli-0.7.0/cortexdb_cli/commands/changes.py +433 -0
  15. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/claims.py +2 -0
  16. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/code.py +12 -0
  17. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/compose.py +14 -7
  18. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/config_cmd.py +50 -50
  19. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/conflicts.py +15 -3
  20. cortexdb_cli-0.7.0/cortexdb_cli/commands/directory.py +225 -0
  21. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/entities.py +4 -0
  22. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/episodes.py +26 -4
  23. cortexdb_cli-0.7.0/cortexdb_cli/commands/erase.py +302 -0
  24. cortexdb_cli-0.7.0/cortexdb_cli/commands/experience.py +378 -0
  25. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/export_cmd.py +20 -5
  26. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/facts.py +43 -15
  27. cortexdb_cli-0.7.0/cortexdb_cli/commands/forget.py +338 -0
  28. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/import_cmd.py +2 -0
  29. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/interactive.py +107 -42
  30. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/onboard.py +59 -11
  31. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/policy.py +3 -0
  32. cortexdb_cli-0.7.0/cortexdb_cli/commands/publish.py +90 -0
  33. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/recall.py +19 -5
  34. cortexdb_cli-0.7.0/cortexdb_cli/commands/rollups.py +153 -0
  35. cortexdb_cli-0.7.0/cortexdb_cli/commands/scopes.py +149 -0
  36. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/search.py +24 -7
  37. cortexdb_cli-0.7.0/cortexdb_cli/commands/tokens.py +166 -0
  38. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/understanding.py +24 -7
  39. cortexdb_cli-0.7.0/cortexdb_cli/commands/watch.py +249 -0
  40. cortexdb_cli-0.7.0/cortexdb_cli/common.py +347 -0
  41. cortexdb_cli-0.7.0/cortexdb_cli/errors.py +651 -0
  42. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/main.py +62 -1
  43. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/output.py +124 -8
  44. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/pyproject.toml +56 -56
  45. cortexdb_cli-0.5.4/.gitignore +0 -109
  46. cortexdb_cli-0.5.4/PKG-INFO +0 -138
  47. cortexdb_cli-0.5.4/README.md +0 -106
  48. cortexdb_cli-0.5.4/cortexdb_cli/client.py +0 -100
  49. cortexdb_cli-0.5.4/cortexdb_cli/commands/experience.py +0 -251
  50. cortexdb_cli-0.5.4/cortexdb_cli/commands/forget.py +0 -132
  51. cortexdb_cli-0.5.4/cortexdb_cli/commands/scopes.py +0 -98
  52. cortexdb_cli-0.5.4/cortexdb_cli/errors.py +0 -96
  53. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/init.py +0 -0
  54. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/commands/wire.py +0 -0
  55. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/config.py +0 -0
  56. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/harness_packs_data.py +0 -0
  57. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/onboarding.py +0 -0
  58. {cortexdb_cli-0.5.4 → cortexdb_cli-0.7.0}/cortexdb_cli/state.py +0 -0
@@ -0,0 +1,378 @@
1
+ Metadata-Version: 2.5
2
+ Name: cortexdb-cli
3
+ Version: 0.7.0
4
+ Summary: Command-line interface for CortexDB — the long-term memory layer for AI.
5
+ Project-URL: Homepage, https://cortexdb.ai
6
+ Project-URL: Documentation, https://cortexdb.ai/docs
7
+ Project-URL: Repository, https://github.com/cortexdb/cortexdb
8
+ Project-URL: Issues, https://github.com/cortexdb/cortexdb/issues
9
+ Author-email: CortexDB Team <team@cortexdb.ai>
10
+ License-Expression: Apache-2.0
11
+ Keywords: agents,ai,cli,cortexdb,llm,memory
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Database
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: click>=8.1
25
+ Requires-Dist: httpx>=0.27
26
+ Requires-Dist: prompt-toolkit>=3.0
27
+ Requires-Dist: rich-click>=1.7
28
+ Requires-Dist: rich>=13.0
29
+ Requires-Dist: tomli-w>=1.0
30
+ Requires-Dist: tomli>=2.0; python_version < '3.11'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # cortexdb-cli
34
+
35
+ Command-line interface for [CortexDB](https://cortexdb.ai) — the long-term memory layer for AI systems.
36
+
37
+ Wraps the v1 HTTP API in a small, fast Click + Rich CLI. Anonymous signup
38
+ in one command, no email or card; works against the public SaaS or any
39
+ self-hosted CortexDB deployment. Version 0.7.0 covers CortexDB 0.14.0,
40
+ shared memory included: the access API, change sets, the directory,
41
+ applications, rollups, publishing and the new erasures.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install cortexdb-cli
47
+ ```
48
+
49
+ Requires Python 3.10+.
50
+
51
+ ## Quickstart
52
+
53
+ ```bash
54
+ # 1. One-time setup — anonymous signup, writes ~/.cortexdb/state.json
55
+ cortexdb init
56
+
57
+ # 2. Store a memory
58
+ cortexdb experience "Q3 revenue: $2.4M. We're on track for $10M ARR by year-end."
59
+
60
+ # 3. Recall it
61
+ cortexdb recall "Q3 revenue?"
62
+
63
+ # 4. Or just type — drops into a REPL
64
+ cortexdb
65
+ ```
66
+
67
+ The signup token has a 7-day TTL on the free tier.
68
+
69
+ **Re-running `cortexdb init` does not refresh it.** `init` reuses an existing
70
+ identity and changes nothing; against an expired one it refuses and exits 3.
71
+ That is deliberate: a new identity is a new *brain*, and memories written
72
+ under the old actor stay where they are, unreachable from the new config.
73
+
74
+ When a token expires you have two safe options:
75
+
76
+ - `cortexdb init --api-key <token> --actor <actor>` — keep the same brain
77
+ with a token you already hold (e.g. from your IdP).
78
+ - `cortexdb init --force` — deliberately start a NEW brain. The previous
79
+ identity is backed up to `state.json.replaced` first.
80
+
81
+ For a second brain alongside the first, isolate instead of replacing:
82
+ `cortexdb --config-dir <dir> init`, or set `CORTEXDB_HOME`.
83
+
84
+ ## What's new for CortexDB 0.14.0 (cortexdb-cli 0.7.0)
85
+
86
+ CortexDB 0.14.0 is the breaking release of shared memory. What changes for a
87
+ CLI user:
88
+
89
+ - **Break-glass.** On `cloud_shared_saas` the operator key's data reads are
90
+ denied by default (`CORTEX_OPERATOR_DATA_READS=deny`): they answer 403
91
+ `BREAK_GLASS_REQUIRED` without `X-Cortex-Break-Glass`. Every command that
92
+ calls the server takes `--break-glass REASON --break-glass-ticket TICKET
93
+ [--break-glass-note TEXT]` (`--ticket` for short; also before the
94
+ subcommand, or as `CORTEXDB_BREAK_GLASS`, `CORTEXDB_BREAK_GLASS_TICKET`,
95
+ `CORTEXDB_BREAK_GLASS_NOTE`). The reason is one of `incident`, `legal`,
96
+ `support`, `security`, `migration`, `restore` or `other`.
97
+ - **Typed errors.** Every refusal prints its code, its `details`, a one-line
98
+ hint and whether it is retriable; `--json` prints `{"error": {...}}` on
99
+ stderr. `BREAK_GLASS_REQUIRED`, a confinement denial, `ACCESS_RESTORE_PENDING`,
100
+ `NOTICE_UNAVAILABLE`, the `CHANGESET_*` codes, `ACCESS_LIMIT_REACHED`,
101
+ `SUBJECT_UNMAPPED`, `PUBLISH_PERSON_REQUIRED`, `FRESH_AUTH_REQUIRED`,
102
+ `CONSISTENCY_TOKEN_INVALID`, `WAIT_TIMEOUT`, `SCOPE_MOVING` and
103
+ `FORMAT_UPGRADE_PENDING` each say what to do.
104
+ - **Strict forget selectors.** The server refuses a selector field it does not
105
+ know (422 `unknown_selector_field`). The REPL's `/forget QUERY` sent one: it
106
+ now lists the events a recall of QUERY returns and forgets the ones you
107
+ pick, by id. `cortexdb forget --query` does the same (a script passes
108
+ `--yes` or `--preview`). `--cascade none` is gone: the cascades are
109
+ `derived_only` and `redact_events`.
110
+ - **Views at org-tree scopes.** `recall`, `answer` and `compose` send a view
111
+ only when you choose one, so a read at a team, an org, a group or a
112
+ compartment gets the server's default (granular there) instead of 422
113
+ `VIEW_NOT_ALLOWED_AT_SCOPE`.
114
+ - **Tokens.** A token that carries `scopes` holds only the families its
115
+ entries name, lifetimes are capped (7 days for a person or an agent, 30 for
116
+ a service, 24 hours with chain claims), and `act` must name a delegable
117
+ agent. Every mint names its tenant root (`--scope`, `--tenant` or its
118
+ `--confine` entries); only the operator mints deployment-wide, for a
119
+ service. A minted token holds no more than its minter. `cortexdb tokens
120
+ mint` mints with every field: `--confine`, `--exact` (the `CAP:PATH!`
121
+ form), `--cap`, `--tenant` and the chain claims.
122
+ - **Names live in the directory.** A scope record's `tree.display_name` is
123
+ refused; use `cortexdb directory put`.
124
+ - **A read's purpose, a record's texts, legal holds.** `--purpose ID` declares
125
+ what a read is for (`recall`, `search`, `answer`, `compose`, `access check`,
126
+ `access explain`, `access authzen evaluate`); `cortexdb access texts erase
127
+ PATH` erases the free text a registry record names on every replica; `forget`
128
+ and its preview show what a legal hold kept. `beliefs create` takes
129
+ `--idempotency-key`, `beliefs why` and `conflicts show` take `--scope`,
130
+ `facts timeline --as-of` is applied, `scopes list` pages (`--cursor`,
131
+ `--all`), and `publish` and `access records` return consistency tokens.
132
+ - **Fixed against 0.14.0** (`COVERAGE.md` has the whole audit): `experience
133
+ "text" --wait ...` and `experience bulk FILE` (the group swallowed both),
134
+ `search` (sent a budget key the server refuses), `facts timeline`
135
+ (`--predicate` is required), `verify` and `apply` (wrote to a scope type no
136
+ preset registers), the forget receipt, and `code import-scip` /
137
+ `import-index`. `scopes register --owner` sends the Owner as a roster
138
+ entry, which every server honours (servers before the final 0.14.0 dropped
139
+ the `owner` field 0.6.0 sent).
140
+
141
+ ## Commands
142
+
143
+ ```
144
+ cortexdb init anonymous signup; persist token + actor
145
+ cortexdb preflight | plan | apply | resume | status | doctor | verify | cleanup
146
+ cortexdb experience "..." store a memory (POST /v1/experience)
147
+ cortexdb experience bulk file.jsonl bulk ingest (POST /v1/experience/bulk)
148
+ cortexdb recall "..." recall a stratified context pack
149
+ cortexdb search "..." granular event-level search
150
+ cortexdb answer "..." recall + LLM answer
151
+ cortexdb compose "..." a markdown document from memory
152
+ cortexdb forget --memory-id | --idempotency-key | --capture-key ...
153
+ cortexdb episodes {list,get,delete}
154
+ cortexdb entities {list,get,link}
155
+ cortexdb facts {list,timeline}
156
+ cortexdb beliefs {list,why,build,create}
157
+ cortexdb conflicts {list,show,resolve}
158
+ cortexdb claims {history}
159
+ cortexdb concepts {list,coverage,synthesize}
160
+ cortexdb scopes {list,register,members}
161
+ cortexdb access {check,explain,lookup,limits,enrich,records,restore-ack,rehome,watermarks,accounts,authzen}
162
+ cortexdb changes {stage,parts,preview,activate,get,discard}
163
+ cortexdb watch [ROOT] [--follow]
164
+ cortexdb notices {list,ack}
165
+ cortexdb apps {put,get}
166
+ cortexdb directory {put,get,delete,search}
167
+ cortexdb rollups {list,get,totals}
168
+ cortexdb publish --target ... --event | --rollup ...
169
+ cortexdb erase {person,tenant,party,status,receipt,verify}
170
+ cortexdb tokens {mint}
171
+ cortexdb auth {whoami,signup,tokens,revoke}
172
+ cortexdb policy {effective,deployment}
173
+ cortexdb admin {health,usage,layers,retention,wal,access,auth,rollups}
174
+ cortexdb audit {chain,verify}
175
+ cortexdb import data.json | backup.jsonl --server
176
+ cortexdb export -o backup.json
177
+ cortexdb code {add,remove,status,import-scip,import-coverage,export-index,import-index,pin,gc,matrix,watch}
178
+ cortexdb config {show,set}
179
+ cortexdb wire --harness ...
180
+ cortexdb interactive REPL
181
+ ```
182
+
183
+ Every command that calls the server takes `--json` and the break-glass
184
+ options. A command whose scope is optional uses your default scope; one that
185
+ takes a tenant root uses the first segment of it.
186
+
187
+ ### Reads: consistency, read sets, coverage
188
+
189
+ `recall`, `search`, `answer` and `compose` take `--extra-scope SCOPE` (up to
190
+ 40), `--coverage` (what was searched, authorized, and the gaps),
191
+ `--beliefs merged` (beliefs rebuilt across the read set for you), `--mounts`
192
+ (your application's admitted mounts), `--consistency`, `--at-least TOKEN` and
193
+ `--purpose ID` (the purpose the read is for: a grant whose `when` names a
194
+ purpose holds only for that one; `access check`, `access explain` and
195
+ `access authzen evaluate` decide a chain for one too). A write returns a consistency token with `--consistency`; a read that passes it
196
+ to `--at-least` sees that write:
197
+
198
+ ```bash
199
+ TOKEN=$(cortexdb experience "ship on Friday" --consistency --json | jq -r .consistency_token)
200
+ cortexdb recall "ship" --at-least "$TOKEN"
201
+ ```
202
+
203
+ `experience write` also takes `--provenance EVENT_ID` (erasing the source
204
+ erases the write), `--intent` and `--idempotency-key`.
205
+
206
+ ### access
207
+
208
+ ```bash
209
+ cortexdb access check org:acme/team:eng --role writer
210
+ cortexdb access check org:acme/team:eng --for user:bob # another chain: Owners and the operator
211
+ cortexdb access explain org:acme/team:eng --memory evt_01...
212
+ cortexdb access lookup scopes org:acme --include-private --all
213
+ cortexdb access lookup principals org:acme/team:eng
214
+ cortexdb access limits org:acme
215
+ cortexdb access enrich org:acme/team:eng
216
+ cortexdb access records org:acme --all # a restore's registry listing
217
+ cortexdb access restore-ack org:acme # acknowledge a restored root
218
+ cortexdb access rehome org:acme/source:slack/container:launch evt_01...
219
+ cortexdb access watermarks put org:acme/source:slack --at 2026-10-26T00:00:00Z
220
+ cortexdb access accounts org:acme --account slack:T1=U123
221
+ cortexdb access texts erase org:acme/team:eng --yes # a record's reasons, matter and notes, everywhere
222
+ cortexdb access authzen evaluate --subject user:alice --action read --resource org:acme/team:eng
223
+ ```
224
+
225
+ A chain is given with `--for SUB` and `--act`, `--app`, `--client`, `--run`,
226
+ `--auth-time`, `--cap`, `--confine`, or whole with `--chain JSON`.
227
+
228
+ ### changes
229
+
230
+ Change sets write registry records all at once. Stage them, preview the access
231
+ diff, activate with the preview's hash:
232
+
233
+ ```bash
234
+ cortexdb changes stage org-compile --file records.json --reason "first compile"
235
+ cortexdb changes preview org-compile --people
236
+ cortexdb changes activate org-compile # previews, shows the diff, asks, activates
237
+ cortexdb changes get org-compile
238
+ cortexdb changes discard org-compile
239
+ ```
240
+
241
+ `--file` holds a list of records (each a put), operations
242
+ (`{"path", "op": "put" | "delete", "record"}`), `{"records": [...]}` or
243
+ `{"parts": [...]}`; `--delete PATH` adds deletes; `changes parts` stages more.
244
+
245
+ ### watch and notices
246
+
247
+ ```bash
248
+ cortexdb watch org:acme # the current position
249
+ cortexdb watch org:acme --after wp1.... --follow
250
+ cortexdb notices list org:acme # who read what of yours
251
+ cortexdb notices ack org:acme --seq 3 # or --through POSITION, or --all
252
+ ```
253
+
254
+ `--follow` long-polls from each page's position (one JSON line per page with
255
+ `--json`) and prints the last position when stopped.
256
+
257
+ ### apps
258
+
259
+ ```bash
260
+ cortexdb apps put notes --kind note --kind decision --mount-prefix org:acme/source:slack
261
+ cortexdb apps get notes
262
+ ```
263
+
264
+ ### directory
265
+
266
+ ```bash
267
+ cortexdb directory put user:alice --display-name "Alice Moreau" --email alice@acme.example \
268
+ --account slack:T1=UALICE
269
+ cortexdb directory put user:alice --merge --title "Staff engineer" # read, change, write on its version
270
+ cortexdb directory put org:acme/team:eng --display-name "Engineering" # a scope's name entry
271
+ cortexdb directory get user:alice
272
+ cortexdb directory search ali
273
+ cortexdb directory delete user:temp
274
+ ```
275
+
276
+ ### rollups and publish
277
+
278
+ ```bash
279
+ cortexdb rollups list --scope org:acme/team:eng/aud:roll
280
+ cortexdb rollups get roll_01... --scope org:acme/team:eng/aud:roll
281
+ cortexdb rollups totals --scope org:acme/team:eng/aud:roll --from 2026-09 --to 2026-10
282
+ cortexdb publish --target org:acme/team:eng --from org:acme/user:alice --event evt_01...
283
+ ```
284
+
285
+ Only a person publishes: a `user:` token with no `act` or `run`, your own or
286
+ one through an admitted application whose client says `client: person`. An
287
+ agent, a run, a service, an application token with no `client` and the
288
+ operator key get 403 `PUBLISH_PERSON_REQUIRED`.
289
+
290
+ ### forget and erase
291
+
292
+ ```bash
293
+ cortexdb forget --memory-id evt_01... --reason "user request"
294
+ cortexdb forget --idempotency-key note-42 --key-caller user:alice --reason "deleted" # reads nothing
295
+ cortexdb forget --capture-key cap:upload-7 --reason "withdrawn"
296
+ cortexdb erase person user:dev --scope org:acme --yes # no server dry run: asks, or --yes
297
+ cortexdb erase tenant --scope org:acme # a dry run
298
+ cortexdb erase tenant --scope org:acme --apply --yes
299
+ cortexdb erase party pat@example.com --scope org:acme # a preview
300
+ cortexdb erase party pat@example.com --scope org:acme --apply --yes
301
+ cortexdb erase status erasure_01... --wait 120
302
+ cortexdb erase receipt erasure_01...
303
+ cortexdb erase verify erasure_01...
304
+ ```
305
+
306
+ A forget needs Owner at its scope. The erasures are the trusted operator's.
307
+
308
+ ### tokens
309
+
310
+ ```bash
311
+ cortexdb tokens mint --subject user:bob --confine scope.read.local:org:acme/team:eng
312
+ cortexdb tokens mint --subject user:bob --exact scope.read.local:org:acme/team:eng # sent as ...eng!
313
+ cortexdb tokens mint --subject user:alice --act agent:helper --run run-7 --client agent \
314
+ --confine scope.write:org:acme/user:alice
315
+ cortexdb tokens mint --subject user:carol --scope org:acme --cap scope.read
316
+ ```
317
+
318
+ Every mint names its tenant root: `--scope` (a scope of it, where your
319
+ `auth.mint` is checked; it never confines the token), `--tenant` (hosted; it
320
+ takes no `--scope`) or its `--confine` / `--exact` entries, all in one root.
321
+ A mint naming none is the operator's, for a `service:` or `system:` subject
322
+ (403 `deployment_mint_requires_operator` otherwise). `auth tokens` takes the
323
+ same flags and prints the raw JSON.
324
+
325
+ ### admin
326
+
327
+ ```bash
328
+ cortexdb admin access report org:acme
329
+ cortexdb admin access tenant-settings org:acme --operator-data-reads deny
330
+ cortexdb admin access tenant-settings org:acme --operator-data-reads allow \
331
+ --break-glass support --break-glass-ticket SUP-1 # lowering from deny
332
+ cortexdb admin access tenant-binding org:acme --from default # a dry run; --apply rebinds
333
+ cortexdb admin access restore --scope org:acme --reason "nothing changed since the backup"
334
+ cortexdb admin auth reload
335
+ cortexdb admin rollups status org:acme
336
+ ```
337
+
338
+ ## Configuration
339
+
340
+ Three layers, in precedence order:
341
+
342
+ 1. **CLI flags** — `--api-key`, `--endpoint`, `--actor`, `--scope`, `--profile`
343
+ 2. **Environment** — `CORTEXDB_API_KEY`, `CORTEXDB_URL`, `CORTEXDB_ACTOR`, `CORTEXDB_SCOPE`
344
+ 3. **Persisted state**:
345
+ - `~/.cortexdb/config.toml` — endpoint, profile names (human-editable)
346
+ - `~/.cortexdb/state.json` — token, actor, scope, expiry (managed by `init`, 0600 on POSIX)
347
+
348
+ The state.json format matches the cortexdb-mcp 0.3.0 server's, so you can
349
+ copy state across to use both tools from the same anonymous identity.
350
+
351
+ ## Pipe-friendly
352
+
353
+ Auto-detects when stdout isn't a TTY and emits JSON:
354
+
355
+ ```bash
356
+ cortexdb recall "Q3 revenue" | jq .context_block
357
+ cortexdb entities list | jq '.[].subject'
358
+ echo "remember this" | cortexdb experience -
359
+ ```
360
+
361
+ Force JSON mode any time with `--json`, before or after the subcommand.
362
+
363
+ ## Auth notes
364
+
365
+ - The v1 API requires both `Authorization: Bearer <PASETO>` and `X-Cortex-Actor`.
366
+ The CLI stamps both on every request — you never need to pass them by hand.
367
+ - 401s show the specific error code (`EXPIRED_TOKEN`, `ACTOR_MISMATCH`, …)
368
+ and the remediation. Note that an expired token is **not** fixed by re-running
369
+ `cortexdb init` — see the identity note above; that would mint a different
370
+ brain rather than restore access to yours.
371
+ - 403s cite the missing capability and the policy tier that denied, or the
372
+ `--confine` entry a confined token lacks. If a recall returns
373
+ `diagnostics.read denied`, pass `--diagnostics none` — free-tier tokens don't
374
+ carry the `diagnostics.read` capability.
375
+
376
+ ## License
377
+
378
+ Apache-2.0