New notes and workbench edges now emit [[Note#Heading ^block]] or [[#^id]] so vaults stay ingestible without mass relinks. Create-from-profile always opens the wizard; a command can restart it on the current note. Co-authored-by: Cursor <cursoragent@cursor.com>
113 lines
3.1 KiB
Markdown
113 lines
3.1 KiB
Markdown
# Modul: Analysis
|
||
|
||
> **Pfad:** `src/analysis/`
|
||
> **Zielgruppe:** Entwickler, Architekten
|
||
|
||
---
|
||
|
||
## Übersicht
|
||
|
||
Das Analysis-Modul enthält die Chain Inspector-Logik, Template Matching, Scoring und Findings-Erzeugung.
|
||
|
||
---
|
||
|
||
## Komponenten
|
||
|
||
| Datei | Beschreibung |
|
||
|-------|--------------|
|
||
| `chainInspector.ts` | Haupt-Analyse-Engine |
|
||
| `templateMatching.ts` | Template Matching, Scoring, Backtracking |
|
||
| `graphIndex.ts` | Graph-Indexierung, Edge-Erfassung |
|
||
| `sectionContext.ts` | Section-Context-Handling |
|
||
| `severityPolicy.ts` | Severity-Policy für Findings |
|
||
|
||
---
|
||
|
||
## Scoring-Logik (Template Matching)
|
||
|
||
### scoreAssignment
|
||
|
||
Die Funktion `scoreAssignment` bewertet jede Slot-Zuordnung:
|
||
|
||
| Komponente | Punkte |
|
||
|------------|--------|
|
||
| Jeder zugewiesene Slot | +2 |
|
||
| Intra-Note-Bonus (alle Slots in derselben Note) | +5 |
|
||
| Erfüllter Link (mit erlaubter Edge-Role) | +10 |
|
||
| Fehlender Link (wenn `required_links: true`) | -5 |
|
||
| Falsche Role (wenn `required_links: true`) | -5 |
|
||
|
||
### Link-Validierung
|
||
|
||
- **findEdgeBetween:** Sucht Edge zwischen zwei Nodes (file:heading)
|
||
- **headingsMatch:** Vergleicht Überschriften (normalisiert über `normalizeHeadingForMatch`)
|
||
- **Role-Mapping:** Edge-Typ → Role via `chain_roles.yaml`
|
||
|
||
### Profile-Auflösung
|
||
|
||
1. **Settings:** `templateMatchingProfile` (`discovery` | `decisioning`)
|
||
2. **Template:** `template.matching.required_links`
|
||
3. **Defaults:** `defaults.matching.required_links`
|
||
|
||
---
|
||
|
||
## Template-Matching-Profile
|
||
|
||
| Profil | required_links | min_slots_filled_for_gap_findings | min_score_for_gap_findings |
|
||
|--------|----------------|-----------------------------------|----------------------------|
|
||
| `discovery` | false | 2 | 8 |
|
||
| `decisioning` | true | 3 | 18 |
|
||
|
||
Profile werden in `chain_templates.yaml` unter `defaults.profiles` definiert.
|
||
|
||
---
|
||
|
||
## Confidence-Berechnung
|
||
|
||
| Confidence | Bedingung |
|
||
|------------|-----------|
|
||
| `confirmed` | slotsComplete AND linksComplete AND mind. eine causal-ish Role |
|
||
| `plausible` | slotsComplete, aber (nicht linksComplete ODER keine causal-ish Role) |
|
||
| `weak` | nicht slotsComplete |
|
||
|
||
**causal-ish Roles:** `["causal", "influences", "enables_constraints"]` (konfigurierbar in `chain_templates.yaml`)
|
||
|
||
---
|
||
|
||
## Analysis Policies
|
||
|
||
Datei: `analysis_policies.yaml` (Pfad via Settings `analysisPoliciesPath`)
|
||
|
||
```yaml
|
||
version: 1
|
||
profiles:
|
||
discovery:
|
||
severities:
|
||
missing_link_constraints: info
|
||
weak_chain_roles: info
|
||
unmapped_edge_types: info
|
||
missing_slot_*: info
|
||
decisioning:
|
||
severities:
|
||
missing_link_constraints: warn
|
||
weak_chain_roles: info
|
||
unmapped_edge_types: warn
|
||
missing_slot_*: warn
|
||
```
|
||
|
||
---
|
||
|
||
## Abhängigkeiten
|
||
|
||
- **Dictionary:** Chain Roles, Chain Templates
|
||
- **Graph:** Graph Index, Traversal
|
||
- **Parser:** Edge-Extraktion
|
||
- **Unresolved Link:** `headingsMatch`, `normalizeHeadingForMatch`
|
||
|
||
---
|
||
|
||
## Siehe auch
|
||
|
||
- [02_concepts/03_chain_identification_and_matching](../02_concepts/03_chain_identification_and_matching.md)
|
||
- [06_Konfigurationsdateien_Referenz](../06_Konfigurationsdateien_Referenz.md) – chain_templates, chain_roles, analysis_policies
|