Adds corporate memory v1 (verification flywheel + contradiction detection + confidence scoring) and v1.5 (audience-based distribution + per-item privacy + admin curation). Server: GET /api/memory/bundle returns mandatory + ranked-approved items within a token budget; POST /api/memory/admin/mandate accepts an audience field gated against user_group_members; /api/memory/stats uses SQL aggregation. CLI: da sync writes received items to .claude/rules/km_*.md. Verification detector extracts knowledge candidates from session JSONL files. Auto-tagging via Haiku when ai: is configured. Adapted from the v9-era branch onto v13/v14 RBAC: _is_privileged_viewer + _effective_groups now query user_group_members JOIN user_groups; require_role(Role.KM_ADMIN) replaced with require_admin (km_admin collapsed into admin). Schema v15: knowledge_items context-engineering columns + knowledge_contradictions + session_extraction_state. Schema v16: verification_evidence. Cuts release v0.15.0 (also bundles #116 /me/debug page).
41 lines
1.8 KiB
Text
41 lines
1.8 KiB
Text
# {instance_name} — AI Data Analyst
|
||
|
||
This workspace is connected to {server_url}.
|
||
|
||
## Rules
|
||
- Before computing any business metric: run `da metrics show <category>/<name>`
|
||
- For current schema: read `data/metadata/schema.json`
|
||
- Do not use DESCRIBE/SHOW COLUMNS — read metadata files instead
|
||
- Save work output to `user/artifacts/`
|
||
- Sync data regularly with `da sync`
|
||
|
||
## Metrics Workflow
|
||
1. `da metrics list` — find the relevant metric
|
||
2. `da metrics show revenue/mrr` — read SQL and business rules
|
||
3. Use the canonical SQL from the metric definition, adapt to the question
|
||
4. Never invent metric calculations — always check existing definitions first
|
||
|
||
## Data Sync
|
||
- `da sync` — download current data from server
|
||
- `da sync --docs-only` — just metadata and metrics (fast refresh)
|
||
- `da sync --upload-only` — upload sessions and local notes to server
|
||
- Data on the server refreshes every {sync_interval}
|
||
|
||
## Corporate Memory
|
||
|
||
Rules injected by `da sync` from the server's corporate knowledge base live in `.claude/rules/km_*.md`. They are automatically loaded by Claude Code on every session start.
|
||
|
||
- `km_<id>.md` — mandatory rules (always enforced)
|
||
- `km_approved.md` — approved guidance (confidence × recency ranked)
|
||
|
||
Run `da sync` to refresh. Rules are pruned automatically when items are revoked.
|
||
|
||
## Directory Structure
|
||
- `data/` — read-only data downloaded from server
|
||
- `data/parquet/` — table data in Parquet format
|
||
- `data/duckdb/` — local analytics DuckDB database
|
||
- `data/metadata/` — profiles, schema, metrics cache
|
||
- `user/` — your workspace (persistent across syncs)
|
||
- `user/artifacts/` — analysis outputs, reports, charts
|
||
- `user/sessions/` — Claude Code session logs
|
||
- `.claude/CLAUDE.local.md` — your personal notes (never overwritten, uploaded on sync)
|