tools.feature_atlas.generate_interaction_prompts module
Step 4: Generate interaction analysis prompts for all feature pairs.
Creates structured prompts for each directed pair (A, B) that include: - Feature A & B descriptions + evidence - Known code interactions between them - The strict JSON output template
Outputs outputs/interaction_prompts.jsonl and loads InteractionPrompt
nodes into FalkorDB.
- Usage:
python -m tools.feature_atlas.generate_interaction_prompts
# fire – ALL DIRECTED NERVE MAPPINGS
- tools.feature_atlas.generate_interaction_prompts.generate_prompt(source_feat, target_feat, interactions)[source]
Assemble the full LLM analysis prompt for one directed feature pair.
Combines per-feature summaries from
_feature_summary()and the code-evidence block from_interaction_evidence()with a fixed instruction header, scoring guide, and the strict JSON output schema (_ANALYSIS_TEMPLATE) into a single prompt string. The prompt directs the downstream model to analyze how feature A affects feature B across direct, indirect, memory, NCM/persona, and routing dimensions and to emit only template-conforming JSON. Pure string assembly; this function does not itself call any LLM, Redis, or knowledge graph (the prompt is consumed later by the interaction-analysis swarm).Called by
generate_all_prompts(), once for every ordered pair of distinct features.- Parameters:
- Return type:
- Returns:
The fully rendered prompt string for this directed pair.
- tools.feature_atlas.generate_interaction_prompts.generate_all_prompts(features, interactions)[source]
Generate prompts for all directed feature pairs.
Returns list of {source_id, target_id, prompt, evidence_count}.
- async tools.feature_atlas.generate_interaction_prompts.load_prompts_to_falkor(prompts)[source]
Persist the generated prompts as InteractionPrompt nodes in FalkorDB.
Opens the Feature Atlas graph via
atlas_connection.get_atlas_graph(which also returns the underlying Redis client) and, for each prompt, callsmerge_interaction_promptto upsert a node keyed by source and target id withstatus="pending"and the prompt text truncated to 10,000 characters. Per-prompt failures are caught and logged via the moduleloggerso one bad write does not abort the batch, and the Redis client is closed withaclosebefore returning. Side effects: writes to the FalkorDB knowledge graph and opens/closes a Redis connection.Called by
async_main()after the prompts have been generated and written to disk.
- async tools.feature_atlas.generate_interaction_prompts.async_main()[source]
Run atlas step 4: build every pair prompt, persist, and report.
The async driver that ties the module together: it loads the feature registry and code interactions via
_load_features()and_load_interactions(), generates a prompt for every directed pair withgenerate_all_prompts(), sorts them by evidence count (most-grounded first), writes them as JSONL tooutputs/interaction_prompts.jsonl(the module-level_OUTPUT_PATH), loads them into FalkorDB viaload_prompts_to_falkor(), and prints a summary of totals and elapsed time. Side effects: reads input JSON files, creates the output directory and writes the JSONL file, writes to the knowledge graph, logs, and prints to stdout.Called by
main()(viaasyncio.run) and dispatched as a subprocess step byrun_atlas.py, which imports this coroutine asrun.- Return type:
- tools.feature_atlas.generate_interaction_prompts.main()[source]
Synchronous wrapper that runs the step-4 prompt generation.
Configures basic logging and drives the async pipeline by calling
asyncio.run(async_main()). This is the plain command-line entry point (python -m tools.feature_atlas.generate_interaction_prompts); all real work, including the filesystem and FalkorDB side effects, happens insideasync_main().Called by the module’s
__main__guard at the bottom of this file.- Return type: