Skip to content

feat(lot-a): cold-start — multi-lang stack detection, git seeding in init, first-session report - #3

Merged
Doucs91 merged 1 commit into
developfrom
feature/cold-start
Jun 3, 2026
Merged

Doucs91 merged 1 commit into
developfrom
feature/cold-start

Conversation

@Doucs91

@Doucs91 Doucs91 commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary

Lot A — Onboarding & Cold-start (P0). haive init ne se termine plus sur un .ai/ quasi vide. Il détecte le stack automatiquement depuis plusieurs manifestes, seed le corpus depuis l'historique git, et termine par un rapport lisible.

  • A1 — Détection multi-langage : nouvelle fonction pure detectStacksFromManifests() dans core/src/seed.ts — gère package.json, requirements.txt, go.mod, pom.xml (Python/Go/Java ajoutés). Testable sans I/O.
  • A2 — Git seeding dans init : haive init lance automatiquement le seeding depuis les commits Revert/hotfix (--seed ON par défaut en autopilot, --no-seed pour désactiver, --seed-limit <n>). Idempotent (ne duplique pas).
  • A3 — Rapport de première session : encadré actionnable à la fin de init (reverts trouvés + récurrents, packs chargés + sensors, total leçons). haive welcome affiche aussi un résumé corpus.
  • A4 — haive ingest CI-ready : header commentaire avec exemples complets ESLint/SARIF, SonarQube fichier et API, dry-run, codes de sortie.
  • A5 — Tests : 25 nouveaux tests dans core/test/seed.test.ts couvrant detectStacksFromManifests (tous les manifestes, dédup, edge cases) et proposeSeedsFromCommits.

Livrable démontrable

cd un-repo-nestjs-avec-historique
haive init
# ┌──────────────────────────────────────────────────────┐
# │  hAIve — first-session report                        │
# ├──────────────────────────────────────────────────────┤
# │  Git signals : 47 commits → 4 revert/hotfix (2 rec.) │
# │  Drafts ready: 4 draft lesson(s) from past mistakes  │
# │  Stack packs : nestjs, prisma — 7 sensor(s) active   │
# │  Total ready : 16 lesson(s), 7 sensor(s) — 0 à la m │
# └──────────────────────────────────────────────────────┘

Fichiers modifiés (Lot A uniquement — propriété respectée)

Fichier Changement
core/src/seed.ts (nouveau) detectStacksFromManifests() pure + types
core/src/index.ts Export de seed.js (ligne ajoutée)
core/test/seed.test.ts (nouveau) 25 tests
cli/commands/init-stack-packs.ts Export StackName, seedStackPack → SeedPackResult
cli/commands/init.ts Multi-lang detection, git seeding, rapport
cli/commands/memory-seed.ts Adapté à SeedPackResult
cli/commands/welcome.ts Corpus summary block
cli/commands/ingest.ts Doc CI en en-tête

Aucun fichier appartenant au Lot B (dashboard.ts, prevention.ts…) ni Lot C (get-briefing.ts, sync.ts…) n'a été touché.

Test plan

  • pnpm -r build vert
  • pnpm -r typecheck vert
  • pnpm -r test vert — 265 tests core, 67 tests CLI (tous verts)
  • 25 nouveaux tests seed.test.ts passent
  • CI GitHub Actions

🤖 Generated with Claude Code

…init, first-session report

A1: detectStacksFromManifests() in core/seed.ts — pure, testable, handles package.json/
    requirements.txt/go.mod/pom.xml (adds Python, Go, Java detection).
A2: haive init now seeds draft memories from git revert/hotfix history automatically
    (--seed on by default in autopilot, --no-seed to skip, --seed-limit <n>).
A3: First-session report printed at end of init and corpus summary in haive welcome.
A4: CI usage documentation added as header comment in ingest.ts.
A5: 25 new tests in core/test/seed.test.ts covering detectStacksFromManifests and
    proposeSeedsFromCommits edge cases.
- seedStackPack now returns { memories, sensors } instead of number.
- memory-seed.ts updated to use new SeedPackResult type.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@Doucs91
Doucs91 merged commit 795168b into develop Jun 3, 2026
3 of 4 checks passed
Doucs91 added a commit that referenced this pull request Jun 4, 2026
…it gate, tighten matcher precision

Deep corpus self-test found the regex sensors (precise, deterministic) were orphaned from the
commit gate: the installed hook ran only `enforce check`, which used the fuzzy anti-pattern matcher
(noisy, missed the real issue). `haive eval` reported catch_rate 1.0 while real commits had zero
sensor protection. Fixes:

#1 Wire sensors into the gate: `runPrecommitPolicy` now runs `runSensorGate` — ALL regex sensors
   (any memory type, not just attempt/gotcha) on the staged diff. block sensor → error (fails gate);
   warn sensor → warn finding (visible, non-blocking). Excludes `.ai/`/hAIve-owned files (self-match
   guard), read-only + best-effort. Verified: `enforce check` now surfaces the TS no-any sensor on a
   `: any` diff (previously silent).
#2 Tighten fuzzy precision (precommit-check.ts): a non-anchored memory whose deterministic sensor did
   NOT fire → info (non-violation evidence); uncorroborated semantic review floor 0.6 → 0.65. Cuts the
   "20 mostly-irrelevant matches for a 3-line diff" noise that trains agents to ignore the gate.
#3 seed-git workaround heuristic: lookbehind/lookahead so compound feature names ("env-workaround",
   "workaround-registry") no longer seed a meaningless attempt; dropped FIXME/XXX from subjects.
#5 memory-lint: LOW_VALUE_GUESSABLE now requires positive generic-advice evidence (looksLikeGenericAdvice)
   so an arbitrary-but-prose team policy isn't mislabeled (killed the UI-language-policy false positive).
#6 stack packs: dedupe slug so the generated name no longer doubles the stack word.

Corpus cleanup: deprecated 2 fixed/audit gotchas (lint RETIRED_ACTIVE), fixed 2 doubled stack-pack
titles, deleted 1 bogus workaround seed. Effect: memory lint 4 → 1 finding; `haive eval` 97 → 100
(MRR 1.0, 0 retrieval misses), sensor catch_rate 1.0, gate precision 0.994.

Tests: 531 green (core 323, mcp 124 incl. 2 new precision tests + 1 seed-git, cli 67, embeddings 17),
tsc clean on all packages.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant