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