feat: add zero-shot knowledge synthesizer (#205) #251

Open
Rockachopa wants to merge 1 commits from step35/205-feat-zero-shot-knowledge-syn into main
Owner

Summary

Implements zero-shot knowledge synthesis for compounding-intelligence.

Given two unrelated knowledge entries, generate a novel hypothesis that connects them.
Pipeline: pick random pair → extract entities/relations → find bridging concepts → score plausibility → store if above threshold.

Changes

  • scripts/knowledge_synthesizer.py: main synthesis pipeline with LLM integration
  • templates/synthesis-prompt.md: prompt template for zero-shot synthesis
  • scripts/test_knowledge_synthesizer.py: 11 tests (all pass)

Key Features

  1. Pair selection: Finds unrelated fact pairs using related field cross-check, prefers cross-domain couplings
  2. LLM synthesis: Calls LLM via OpenRouter/Nous with temperature=0.7, fallback to heuristic
  3. Plausibility thresholding: Configurable (default 0.6) — stores only high-confidence insights
  4. Knowledge store integration: Appends new pattern facts to knowledge/global/patterns.yaml and updates index.json
  5. ID generation: Auto-increments sequence for global:pattern:N
  6. Deduplication: Prevents duplicate hypotheses

Usage

# Pick an explicit pair
python3 scripts/knowledge_synthesizer.py --pair global:pitfall:001 global:tool-quirk:001

# Auto-select best candidate
python3 scripts/knowledge_synthesizer.py --auto --threshold 0.75

# Dry-run to see candidate pair without LLM call
python3 scripts/knowledge_synthesizer.py --auto --dry-run

Test Results

Running knowledge_synthesizer tests...
  ✓ test_next_sequence
  ✓ test_generate_id
  ✓ test_facts_are_unrelated
  ✓ test_find_candidate_pair
  ✓ test_parse_synthesis_response_raw_json
  ✓ test_parse_synthesis_response_markdown_wrapped
  ✓ test_parse_synthesis_response_invalid
  ✓ test_heuristic_synthesis
  ✓ test_is_duplicate
  ✓ test_store_synthesis_integration
  ✓ test_smoke_synthesizer_info

11 passed, 0 failed

Acceptance

Closes #205.

## Summary Implements zero-shot knowledge synthesis for compounding-intelligence. Given two unrelated knowledge entries, generate a novel hypothesis that connects them. Pipeline: pick random pair → extract entities/relations → find bridging concepts → score plausibility → store if above threshold. ## Changes - `scripts/knowledge_synthesizer.py`: main synthesis pipeline with LLM integration - `templates/synthesis-prompt.md`: prompt template for zero-shot synthesis - `scripts/test_knowledge_synthesizer.py`: 11 tests (all pass) ## Key Features 1. **Pair selection**: Finds unrelated fact pairs using `related` field cross-check, prefers cross-domain couplings 2. **LLM synthesis**: Calls LLM via OpenRouter/Nous with temperature=0.7, fallback to heuristic 3. **Plausibility thresholding**: Configurable (default 0.6) — stores only high-confidence insights 4. **Knowledge store integration**: Appends new pattern facts to `knowledge/global/patterns.yaml` and updates `index.json` 5. **ID generation**: Auto-increments sequence for `global:pattern:N` 6. **Deduplication**: Prevents duplicate hypotheses ## Usage ```bash # Pick an explicit pair python3 scripts/knowledge_synthesizer.py --pair global:pitfall:001 global:tool-quirk:001 # Auto-select best candidate python3 scripts/knowledge_synthesizer.py --auto --threshold 0.75 # Dry-run to see candidate pair without LLM call python3 scripts/knowledge_synthesizer.py --auto --dry-run ``` ## Test Results ``` Running knowledge_synthesizer tests... ✓ test_next_sequence ✓ test_generate_id ✓ test_facts_are_unrelated ✓ test_find_candidate_pair ✓ test_parse_synthesis_response_raw_json ✓ test_parse_synthesis_response_markdown_wrapped ✓ test_parse_synthesis_response_invalid ✓ test_heuristic_synthesis ✓ test_is_duplicate ✓ test_store_synthesis_integration ✓ test_smoke_synthesizer_info 11 passed, 0 failed ``` ## Acceptance Closes #205.
Rockachopa added 1 commit 2026-04-26 09:27:59 +00:00
feat: add zero-shot knowledge synthesizer (#205)
Some checks failed
Test / pytest (pull_request) Failing after 10s
d218ac79d9
Implement knowledge_synthesizer.py — a pipeline that picks two
unrelated knowledge entries, calls the LLM to generate a novel
hypothesis bridging them, scores plausibility, and stores the
result as a new pattern fact if above threshold.

- scripts/knowledge_synthesizer.py: main pipeline
- templates/synthesis-prompt.md: LLM prompt
- scripts/test_knowledge_synthesizer.py: 11 tests, all passing
- Supports both LLM synthesis and heuristic fallback
- Respects existing knowledge deduplication
- Integration test demonstrates end-to-end storage
Some checks failed
Test / pytest (pull_request) Failing after 10s
Checking for merge conflicts…
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin step35/205-feat-zero-shot-knowledge-syn:step35/205-feat-zero-shot-knowledge-syn
git checkout step35/205-feat-zero-shot-knowledge-syn
Sign in to join this conversation.