Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
1975 lines (1835 loc) · 54.1 KB
/
Copy pathopenapi.yaml
File metadata and controls
1975 lines (1835 loc) · 54.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: QubicDB HTTP API
version: 1.0.0
description: |
Production-oriented OpenAPI contract for QubicDB's HTTP interface.
Full operations reference: [`docs/API.md`](./docs/API.md)
---
## Introduction
QubicDB is a **brain-like recursive memory database** for LLM applications, written in Go.
It is not a vector store wrapper, not a key-value cache, and not a document database.
It is a **per-index memory runtime** where each index owns:
- An isolated in-memory `Matrix` (N-dimensional neuron space)
- A dedicated serialized `BrainWorker` goroutine (no cross-index lock contention)
- A lifecycle state machine: Active → Idle → Sleeping → Dormant
- Background daemons: Decay, Consolidate, Prune, Persist, Reorg
- A hybrid lexical + vector search engine with brain-mechanics ranking
---
## What problem does it solve?
| Problem | QubicDB answer |
|---|---|
| Session cold start | Per-index persistent matrix, auto-loaded on access |
| Shallow retrieval | Energy/recency/access/depth multipliers on every score |
| Multi-tenant bleed | Per-index worker isolation, no shared state |
| Ops gap | Full admin API, lifecycle control, runtime config patch |
| Semantic gap | Hybrid α-blended lexical+vector scoring with graceful fallback |
---
## Architecture
```
HTTP Client / SDK / MCP Client
│
▼
pkg/api/server.go (Rate Limiter, CORS, Admin Basic Auth)
│
▼
WorkerPool → BrainWorker["index-A"] (goroutine + queue)
│
▼
MatrixEngine (AddNeuron, Searcher, spreadActivation)
│
├── pkg/core/types.go (Matrix, Neuron, Synapse, BrainState)
├── pkg/vector/vectorizer (GGUF embedding, SIMD cosine)
└── pkg/persistence/store.go (WAL + .nrdb + CRC32 + gzip)
```
**Key design decisions:**
- One worker per index — all operations serialized through a single goroutine queue
- Organic matrix — dimension grows with neurons (bounded by `matrix.maxDimension`)
- Vectorizer is global — loaded once, passed through WorkerPool → BrainWorker → Searcher
- Registry is optional — `registry.enabled=false` (default) allows any UUID
---
## Data Model
**Neuron** — the fundamental memory unit:
- `id` (UUID), `content` (string), `content_hash` (SHA-1, deduplication key)
- `energy` [0.0–1.0] — born at 1.0, decays over time, boosted on search hit
- `depth` — 0=surface/hot, higher=consolidated/deep
- `last_fired_at`, `access_count` — drive recency and importance scoring
- `embedding` []float32 — 384-dim MiniLM vector, set once on write (nil if vector disabled)
**Synapse** — Hebbian connection between neurons:
- `weight` [0.0–1.0] — strengthens on co-activation, decays over time
- `bidirectional=true` — traversed both ways in spread activation
**Matrix** — per-index memory space:
- `neurons`, `synapses`, `adjacency` maps
- `current_dim` — grows organically, bounded by `matrix.maxDimension`
- `version` — monotonic counter used by persistence layer
---
## Lifecycle State Machine
```
Active ──(idleThreshold=30s)──► Idle ──(sleepThreshold=5m)──► Sleeping ──(dormantThreshold=30m)──► Dormant
▲ │
└──────────────────────────── wake() ◄──────────────────────────────────────────────────────────────┘
```
Any incoming operation auto-wakes a sleeping/dormant index.
Workers idle beyond `worker.maxIdleTime` (default 30m) are evicted; matrix reloaded from disk on next access.
Lifecycle thresholds are runtime-patchable via `POST /v1/config`.
---
## Persistence — NRDB Format
Each index is stored as a single `.nrdb` binary file:
```
Header: "NRDB" magic + version + flags + CRC32 checksum
Payload: msgpack(Matrix) [optionally gzip-compressed]
```
- WAL (`storage.walEnabled=true`) — every write appended before flush
- fsync policy: `always | interval | off` (default: `interval` at 1s)
- Startup repair: WAL replay on crash recovery (`storage.startupRepair=true`)
---
## Hybrid Search Scoring
```
stringScore = exactPhraseMatch(+10) + wordOverlap(+5) + fuzzyLevenshtein(+2)
vectorScore = max(CosineSimilarity(queryVec, neuron.Embedding), 0) [SIMD-accelerated]
baseScore = α × vectorScore + (1-α) × (stringScore / (stringScore + 1))
where α = vector.alpha (default 0.6)
fallback: baseScore = stringScore (when vector unavailable)
finalScore = baseScore
× (0.5 + energy × 0.5) ← energy boost
× (0.8 + 0.2/(1 + ageHours/24)) ← recency boost
× (1 + 0.1 × log10(accessCount+1)) ← access importance
× (1/(1 + depth × 0.2)) ← depth penalty
```
Spread activation traverses the synapse adjacency graph up to `depth` hops.
`vector.alpha` is patchable at runtime via `POST /v1/config`.
---
## What's new in current production surface
- **Hybrid search** — lexical + GGUF embedding vector scoring, α-weighted, SIMD cosine similarity
- **Runtime config patch** — `POST /v1/config` with explicit safe-field whitelist, partial apply
- **Registry guard** — `registry.enabled` for controlled index admission
- **Config-driven admin auth** — Basic Auth with SHA-256 constant-time comparison
- **Standardized error envelope** — machine-readable `code` field, stable across versions
- **MCP endpoint** — optional streamable HTTP MCP with per-tool allowlist and dedicated rate limiter
- **Connection strings** — `qubicdb://` and `qubicdb+tls://` for SDK/CLI interoperability
- **WAL + fsync policy** — `always | interval | off` with startup repair
- **Checksum validation** — CRC32 on every `.nrdb` file, optional background scan interval
---
## Scope
- This spec covers the REST API exposed by `pkg/api/server.go`.
- Index-scoped endpoints require **one** index selector:
- `X-Index-ID` header (preferred)
- `indexId` query parameter
- `index_id` query parameter
- Admin routes require HTTP Basic Auth when `admin.enabled=true`.
## Important behavior
- Direct mutation routes (`/v1/touch`, `/v1/forget/{id}`, `/v1/fire/{id}`) are intentionally
disabled and return `MUTATION_DISABLED`. Memory mutation must remain organic/internal.
- `search` and `context` clamp depth/limits to server-side maxima (depth≤8, limit≤200, maxTokens≤16000).
- Runtime config patching (`POST /v1/config`) only allows a controlled subset of fields.
- Duplicate `content_hash` on write fires the existing neuron instead of inserting a duplicate.
---
## Benchmarks (Apple M3, arm64)
| Benchmark | ns/op | Notes |
|---|---:|---|
| MatrixEngineAddNeuron | 704,893 | Single neuron write |
| MatrixEngineSearch (1K neurons) | 2,277,576 | Lexical search |
| MatrixEngineParallelSearch | 414,734 | Concurrent read-lock |
| BrainWorkerAddNeuron | 1,394,905 | Through worker queue |
| BrainWorkerParallel (async) | **80** | Async submit overhead |
Full repro commands and capacity planning: [`docs/API.md`](./docs/API.md)
externalDocs:
description: Detailed mechanics, config hierarchy, and operational docs
url: ./docs/API.md
servers:
- url: http://localhost:6060
description: Local development
- url: https://localhost:6060
description: Local TLS (when `security.tlsCert`/`security.tlsKey` configured)
tags:
- name: Health
- name: Memory
- name: Brain
- name: Registry
- name: Observability
- name: Command
- name: Admin
- name: Runtime Config
paths:
/health:
get:
tags: [Health]
summary: Health probe
operationId: getHealth
responses:
'200':
description: Service health snapshot
content:
application/json:
schema:
$ref: '#/components/schemas/HealthResponse'
'429':
$ref: '#/components/responses/RateLimited'
/v1/write:
post:
tags: [Memory]
summary: Write a memory (create neuron)
description: Creates a neuron inside the selected index (brain instance).
operationId: writeMemory
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WriteRequest'
responses:
'200':
description: Memory written (or duplicate content neuron re-fired)
content:
application/json:
schema:
$ref: '#/components/schemas/NeuronDocument'
'400':
description: Validation/index errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'413':
$ref: '#/components/responses/PayloadTooLarge'
'429':
$ref: '#/components/responses/RateLimited'
/v1/read/{id}:
get:
tags: [Memory]
summary: Read one neuron by ID
operationId: readMemory
parameters:
- $ref: '#/components/parameters/NeuronIdPath'
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Neuron document
content:
application/json:
schema:
$ref: '#/components/schemas/NeuronDocument'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
/v1/recall:
get:
tags: [Memory]
summary: Recall neurons (list memory)
description: Returns up to 100 neurons, sorted by energy descending.
operationId: recallMemory
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Recall result
content:
application/json:
schema:
$ref: '#/components/schemas/RecallResponse'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalError'
'429':
$ref: '#/components/responses/RateLimited'
/v1/search:
get:
tags: [Memory]
summary: Search neurons (GET)
description: |
Query-string variant of search.
Server clamps:
- `depth` to max 8
- `limit` to max 200
operationId: searchMemoryGet
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
- in: query
name: q
required: true
schema:
type: string
description: Search query string.
- in: query
name: depth
required: false
schema:
type: integer
minimum: 1
default: 2
- in: query
name: limit
required: false
schema:
type: integer
minimum: 1
default: 20
responses:
'200':
description: Search results
content:
application/json:
schema:
$ref: '#/components/schemas/SearchResponse'
'400':
$ref: '#/components/responses/BadRequest'
'429':
$ref: '#/components/responses/RateLimited'
post:
tags: [Memory]
summary: Search neurons (POST)
description: |
JSON-body variant of search.
Search uses hybrid lexical/vector scoring when vector embeddings are enabled.
operationId: searchMemoryPost
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SearchRequest'
responses:
'200':
description: Search results
content:
application/json:
schema:
$ref: '#/components/schemas/SearchResponse'
'400':
$ref: '#/components/responses/BadRequest'
'413':
$ref: '#/components/responses/PayloadTooLarge'
'429':
$ref: '#/components/responses/RateLimited'
/v1/context:
post:
tags: [Memory]
summary: Build token-aware LLM context
description: |
Runs search from cue, then assembles context text until token budget is reached.
Token count is estimated as `len(content)/4` per neuron.
operationId: buildContext
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ContextRequest'
responses:
'200':
description: Context assembly result
content:
application/json:
schema:
$ref: '#/components/schemas/ContextResponse'
'400':
$ref: '#/components/responses/BadRequest'
'413':
$ref: '#/components/responses/PayloadTooLarge'
'429':
$ref: '#/components/responses/RateLimited'
/v1/command:
post:
tags: [Command]
summary: Execute MongoDB-like command
description: |
Runs protocol commands (`find`, `findOne`, `insert`, `count`, `search`, `stats`, ...).
Direct mutation command types (`update`, `updateOne`, `delete`, `deleteOne`, `activate`)
are intentionally blocked and return `MUTATION_DISABLED`.
operationId: executeCommand
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CommandRequest'
responses:
'200':
description: Command result envelope
content:
application/json:
schema:
$ref: '#/components/schemas/CommandResponse'
'400':
$ref: '#/components/responses/BadRequest'
'413':
$ref: '#/components/responses/PayloadTooLarge'
'429':
$ref: '#/components/responses/RateLimited'
/v1/touch:
put:
tags: [Memory]
summary: Mutation disabled
operationId: mutationTouchPut
responses:
'400':
description: Direct mutation disabled
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
tags: [Memory]
summary: Mutation disabled
operationId: mutationTouchPost
responses:
'400':
description: Direct mutation disabled
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/v1/forget/{id}:
delete:
tags: [Memory]
summary: Mutation disabled
operationId: mutationForget
parameters:
- $ref: '#/components/parameters/NeuronIdPath'
responses:
'400':
description: Direct mutation disabled
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/v1/fire/{id}:
post:
tags: [Memory]
summary: Mutation disabled
operationId: mutationFire
parameters:
- $ref: '#/components/parameters/NeuronIdPath'
responses:
'400':
description: Direct mutation disabled
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/v1/brain/state:
get:
tags: [Brain]
summary: Get brain state
operationId: getBrainState
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Brain state
content:
application/json:
schema:
$ref: '#/components/schemas/BrainStateResponse'
'400':
$ref: '#/components/responses/BadRequest'
/v1/brain/wake:
post:
tags: [Brain]
summary: Force brain wake
operationId: wakeBrain
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Wake acknowledgement
content:
application/json:
schema:
$ref: '#/components/schemas/SimpleStatusResponse'
'400':
$ref: '#/components/responses/BadRequest'
/v1/brain/sleep:
post:
tags: [Brain]
summary: Force brain sleep
operationId: sleepBrain
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Sleep acknowledgement
content:
application/json:
schema:
$ref: '#/components/schemas/SimpleStatusResponse'
'400':
$ref: '#/components/responses/BadRequest'
/v1/brain/stats:
get:
tags: [Brain]
summary: Per-index brain statistics
operationId: getBrainStats
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Index stats
content:
application/json:
schema:
$ref: '#/components/schemas/BrainStatsResponse'
'400':
$ref: '#/components/responses/BadRequest'
/v1/stats:
get:
tags: [Observability]
summary: Global pool + lifecycle statistics
operationId: getGlobalStats
responses:
'200':
description: Global stats
content:
application/json:
schema:
$ref: '#/components/schemas/GlobalStatsResponse'
/v1/synapses:
get:
tags: [Observability]
summary: List synapses for an index
operationId: getSynapses
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Synapse list
content:
application/json:
schema:
$ref: '#/components/schemas/SynapseListResponse'
'400':
$ref: '#/components/responses/BadRequest'
/v1/graph:
get:
tags: [Observability]
summary: Get graph nodes/edges for visualization
operationId: getGraph
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Graph payload
content:
application/json:
schema:
$ref: '#/components/schemas/GraphResponse'
'400':
$ref: '#/components/responses/BadRequest'
/v1/activity:
get:
tags: [Observability]
summary: Get recent neuron/synapse activity
operationId: getActivity
parameters:
- $ref: '#/components/parameters/IndexIdHeader'
- $ref: '#/components/parameters/IndexIdQueryCamel'
- $ref: '#/components/parameters/IndexIdQuerySnake'
responses:
'200':
description: Activity feed
content:
application/json:
schema:
$ref: '#/components/schemas/ActivityResponse'
'400':
$ref: '#/components/responses/BadRequest'
/v1/registry:
get:
tags: [Registry]
summary: List registry entries
operationId: listRegistryEntries
responses:
'200':
description: Registry collection
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryListResponse'
post:
tags: [Registry]
summary: Create registry entry
operationId: createRegistryEntry
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryCreateRequest'
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryEntry'
'400':
$ref: '#/components/responses/BadRequest'
'409':
$ref: '#/components/responses/Conflict'
/v1/registry/{uuid}:
get:
tags: [Registry]
summary: Get registry entry
operationId: getRegistryEntry
parameters:
- $ref: '#/components/parameters/UUIDPath'
responses:
'200':
description: Registry entry
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryEntry'
'404':
$ref: '#/components/responses/NotFound'
put:
tags: [Registry]
summary: Update registry entry
operationId: updateRegistryEntry
parameters:
- $ref: '#/components/parameters/UUIDPath'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryUpdateRequest'
responses:
'200':
description: Updated registry entry
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryEntry'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
delete:
tags: [Registry]
summary: Delete registry entry
operationId: deleteRegistryEntry
parameters:
- $ref: '#/components/parameters/UUIDPath'
responses:
'200':
description: Delete acknowledgement
content:
application/json:
schema:
type: object
required: [deleted, uuid]
properties:
deleted:
type: boolean
uuid:
type: string
'404':
$ref: '#/components/responses/NotFound'
/v1/registry/find-or-create:
post:
tags: [Registry]
summary: Find-or-create registry entry
operationId: findOrCreateRegistryEntry
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryFindOrCreateRequest'
responses:
'200':
description: Existing entry resolved
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryFindOrCreateResponse'
'201':
description: New entry created
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryFindOrCreateResponse'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalError'
/admin/login:
post:
tags: [Admin]
summary: Validate admin credentials
description: |
Validates credentials and returns a success message.
Session/token is not issued; clients must send HTTP Basic Auth on subsequent admin requests.
operationId: adminLogin
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminLoginRequest'
responses:
'200':
description: Auth success
content:
application/json:
schema:
$ref: '#/components/schemas/AdminLoginSuccess'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/admin/indexes:
get:
tags: [Admin]
summary: List active indexes in worker pool
operationId: adminListIndexes
security:
- AdminBasicAuth: []
responses:
'200':
description: Active index IDs
content:
application/json:
schema:
type: array
items:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
/admin/indexes/{indexId}:
get:
tags: [Admin]
summary: Get index details
operationId: adminGetIndexDetail
security:
- AdminBasicAuth: []
parameters:
- $ref: '#/components/parameters/AdminIndexIdPath'
responses:
'200':
description: Index stats and lifecycle state
content:
application/json:
schema:
type: object
properties:
stats:
type: object
additionalProperties: true
state:
type: object
nullable: true
additionalProperties: true
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
delete:
tags: [Admin]
summary: Delete index from memory/disk and optionally registry
operationId: adminDeleteIndex
security:
- AdminBasicAuth: []
parameters:
- $ref: '#/components/parameters/AdminIndexIdPath'
responses:
'200':
description: Deletion result
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteIndexResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalError'
/admin/indexes/{indexId}/reset:
post:
tags: [Admin]
summary: Truncate index data
operationId: adminResetIndex
security:
- AdminBasicAuth: []
parameters:
- $ref: '#/components/parameters/AdminIndexIdPath'
responses:
'200':
description: Reset result
content:
application/json:
schema:
type: object
required: [reset, truncated, indexId]
properties:
reset:
type: boolean
truncated:
type: boolean
indexId:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalError'
/admin/indexes/{indexId}/wake:
post:
tags: [Admin]
summary: Force wake for index
operationId: adminWakeIndex
security:
- AdminBasicAuth: []
parameters:
- $ref: '#/components/parameters/AdminIndexIdPath'
responses:
'200':
description: Wake result
content:
application/json:
schema:
type: object
required: [woke, indexId]
properties:
woke:
type: boolean
indexId:
type: string
/admin/indexes/{indexId}/sleep:
post:
tags: [Admin]
summary: Force sleep for index
operationId: adminSleepIndex
security:
- AdminBasicAuth: []
parameters:
- $ref: '#/components/parameters/AdminIndexIdPath'
responses:
'200':
description: Sleep result
content:
application/json:
schema:
type: object
required: [slept, indexId]
properties:
slept:
type: boolean
indexId:
type: string
/admin/indexes/{indexId}/export:
get:
tags: [Admin]
summary: Export index stats snapshot
operationId: adminExportIndex
security:
- AdminBasicAuth: []
parameters:
- $ref: '#/components/parameters/AdminIndexIdPath'
responses:
'200':
description: Export payload (currently same shape as brain stats)
content:
application/json:
schema:
$ref: '#/components/schemas/BrainStatsResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/admin/daemons:
get:
tags: [Admin]
summary: Get daemon status
operationId: adminDaemonStatus
security:
- AdminBasicAuth: []
responses:
'200':
description: Daemon status map
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDaemonStatusResponse'
/admin/daemons/pause:
post:
tags: [Admin]
summary: Pause daemons (logical endpoint)
operationId: adminPauseDaemons
security:
- AdminBasicAuth: []
responses:
'200':
description: Pause acknowledgement
content:
application/json:
schema:
type: object
required: [paused]
properties:
paused:
type: boolean
/admin/daemons/resume:
post:
tags: [Admin]
summary: Resume daemons (logical endpoint)
operationId: adminResumeDaemons