Skip to content

Commit b9339ef

Browse files
andinuxclaude
andcommitted
docs: surface n_tokens/truncated columns in API.md statistics
Add example queries for the schema-version-2 columns on dbmem_vault so readers can discover token-usage aggregation and truncation diagnostics without having to read the source. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9d9494a commit b9339ef

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

API.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,21 @@ FROM dbmem_content
770770
WHERE last_accessed > 0
771771
ORDER BY last_accessed DESC
772772
LIMIT 10;
773+
774+
-- Tokens consumed and truncation per context
775+
-- (n_tokens / truncated were added in schema version 2)
776+
SELECT
777+
COALESCE(c.context, '(none)') as context,
778+
SUM(v.n_tokens) as tokens_processed,
779+
SUM(v.truncated) as truncated_chunks
780+
FROM dbmem_vault v
781+
JOIN dbmem_content c ON c.hash = v.hash
782+
GROUP BY c.context;
783+
784+
-- Chunks that the embedding model truncated on input
785+
SELECT hash, seq, length, n_tokens
786+
FROM dbmem_vault
787+
WHERE truncated = 1;
773788
```
774789

775790
---

0 commit comments

Comments
 (0)