Technical Knowledge Consolidation Pipeline

Run this sometimes to clean up documentation debt. It helps you merge and sort technical notes into a clear and organized knowledge base.

How to use

Use this periodically (e.g., weekly) to maintain the quality of your memory files.

Prompt

ROLE: Senior Principal Software Architect (Monorepo & AI-Infrastructures)

CONTEXT:

  • REPOSITORY: Complex monorepo using Turborepo.
  • SOURCE DATA: raw JSONL conversation history in /Users/cebreus/.gemini/tmp/bits/chats.
  • TARGET: Hierarchical memories/*.md files and GEMINI.md indexes.

TASK: REPRODUCIBLE KNOWLEDGE EXTRACTION PIPELINE

Execute a multi-stage pipeline to extract, consolidate, and sort technical gotchas.

STAGE 1: TECHNICAL PREPARATION (MANDATORY)

  1. You MUST NOT read JSONL files directly via standard read tools (too large).
  2. Write a Node.js helper script (tools/extract_history.mjs) that:
  • Uses readline to stream JSONL.
  • Extracts only user and gemini text content.
  • Captures the startTime from the session header or the first timestamp.
  • Outputs a clean text file for each session.
  1. Run this script over all history files and store temporary extracts.

STAGE 2: SEMANTIC ANALYSIS & CHUNKING

  1. Process extracted text in chunks (max 50k tokens) using sub-agents.
  2. Identify "GOTCHAS": Non-obvious technical traps, dependency leaks, or build quirks.
  3. ZERO HALLUCINATION: Extract exact timestamps for "Date Discovered". If missing, use "UNKNOWN".

STAGE 3: SEMANTIC AUDIT & CONSOLIDATION

  1. AGGREGATE: Collect all existing **/memories/*.md files.
  2. MERGE: If a new gotcha overlaps with an existing one, merge them into a single, high-fidelity entry.
  3. PROMOTION: If a rule is applicable monorepo-wide, move it to root memories/.
  4. PRUNING: Remove generic/non-technical advice.

STAGE 4: ATOMIC FILE SYSTEM UPDATE (SORTING)

  1. Write to [scope]/memories/[category]-gotchas.md.
  2. Apply STRICT SORTING:
  • Header & Description at the top.
  • All "Date Discovered: UNKNOWN" entries first.
  • Dated entries sorted chronologically: OLDEST to NEWEST.
  1. FORMATTING: Use ## 🚨 [Gotcha Name] (H2).
  2. CLEANUP: Delete files that became empty and remove their references from GEMINI.md.

STAGE 5: INDEXING & FINAL CLEANUP

  1. Ensure all memories/*.md are linked in the local GEMINI.md.
  2. DELETE all temporary scripts and text extracts created in Stage 1.

OUTPUT:

Table of consolidated gotchas and confirmation of standardized file structure.

Attachments