Self Awareness
Claude Science's own session database schema and SDK surface for introspection via...
Install
npx skills add HughYau/AcademicForge --skill self-awareness -g -a claude-code -y- Repository
- HughYau/AcademicForge2.6k
- Category
- Data and ML
- Updated
- 2mo ago
- License
- Apache-2.0
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Claude Science's own session database schema and SDK surface for introspection via host.query(). Load this when you need to query your own conversation history, token usage, cost accounting, execution log, or artifact metadata beyond what host.frames()/host.artifacts() provide, e.g. "how many tokens has this session used", "what was my last tool call", "list every file I've written", "where are messages stored", "what tables can I query", "inspect frames.context_data", or any time you're about to PRAGMA-probe the Claude Science metadata DB to discover its schema.
Self-awareness, Claude Science's own database and SDK
host.query(sql, params=[], limit=None, df=False) runs read-only SQLite
against Claude Science's own metadata DB. It is only available via the repl
tool (not python/r). Results are automatically scoped to the current
project, so SELECT * FROM frames returns only frames in this project. The
repl tool is stdlib-only, df=True returns the raw dict there (use
json.dump(..., open("handoff/q.json","w")) and load in a python cell if
you want pandas).
Dialect and limits
- SQLite. Epoch-milliseconds for all timestamps
(
created_at > strftime('%s','now','-1 day')*1000). Booleans are0/1. JSON columns are TEXT, usejson_extract(col, '$.key'). Recursive CTEs OK. SELECT/WITH/PRAGMA/EXPLAINonly; one statement per call;?placeholders withparams=[...].- Scoping. Most tables are transparently filtered to the current
project (and
memoriesto the current user) via CTEs that shadow the real tables,session_claims,verification_checks, andpoller_leaseare unscoped. You therefore cannot usemain.table/temp.table, schema-qualified names are rejected. - Caps. Default 200 rows (max
limit=1000); cells >2000 chars are clipped in place with a…[+N chars]marker; total serialized output capped at ~100k chars (truncated=True,truncation_reason="total_size_cap", narrow your columns). 5-second timeout. - Schema introspection:
host.query("PRAGMA table_info(frames)")orhost.query("SELECT name, sql FROM sqlite_master WHERE type='table'").
