KeiSeiKit-1.0/skills/self-audit/phase-1-analyze.md
Parfii-bot 0be354a920 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

53 lines
1.3 KiB
Markdown

# Phase 1 — Analyze
Run the `kei-memory` analyzer against the target session and aggregate
its output into a `FINDINGS` list for downstream phases.
## 1a — Resolve session
If the caller passed an argument, use it verbatim as `SESSION`. Otherwise
resolve via:
```
kei-memory analyze --last 1 --summary
```
Parse the `session=<id>` field from the first line. That is `SESSION`.
If the command fails (exit != 0) OR returns `(no sessions ingested yet)`
— return the 3 constructive paths from the skill's RULE -1 clause and
stop; do not proceed to Phase 2.
## 1b — Retrospective
```
kei-memory analyze --session <SESSION>
```
Capture the full report as `REPORT`. It includes: duration, tool-call
count, error count, top tools, top files.
## 1c — In-session patterns
```
kei-memory patterns --session <SESSION>
```
Capture each line as `{event_class, count, session_id: SESSION}` and
append to `FINDINGS` with `scope = "in-session"`.
## 1d — Cross-session patterns
```
kei-memory patterns --cross-session
```
Capture each line as `{event_class, count, session_id: null}` and
append to `FINDINGS` with `scope = "cross-session"`.
## Verify-criterion
- `SESSION` is a non-empty session id.
- `REPORT` is captured (even if empty).
- `FINDINGS` is a list (possibly empty). Empty → Phase 5 short-circuit
(nothing to triage, nothing to route).