tools.feature_atlas.load_features_to_falkor module
Step 2: Load Feature nodes into FalkorDB.
Reads outputs/feature_registry.json and MERGEs each feature as a
node into the stargazer_feature_interaction_atlas graph.
Fully idempotent – safe to re-run.
- Usage:
python -m tools.feature_atlas.load_features_to_falkor
# skull – BONES INTO THE GRAPH
- tools.feature_atlas.load_features_to_falkor.load_feature_registry()[source]
Read and parse the feature registry produced by the extraction swarm.
Loads the canonical list of features discovered upstream so the loader has something to MERGE into the graph. It is the single source of truth for “which features exist” at the start of Step 2, which is why it fails loudly rather than returning an empty list when the registry is absent.
This is a pure local-filesystem read with no service interactions: it opens
outputs/feature_registry.jsonfrom the module-level_FEATURE_REGISTRY_PATHand returns the deserialized JSON list. Called byload_features()(as the default source when nofeaturesargument is supplied) and byasync_main()(to obtain the total count for the summary report).- Returns:
One feature dict per registry entry, each typically carrying
id,confidence,filesandsymbolskeys consumed bymerge_feature.- Return type:
- Raises:
FileNotFoundError – If
_FEATURE_REGISTRY_PATHdoes not exist, signalling thatextract_features_swarm.pyhas not been run yet.json.JSONDecodeError – If the registry file is not valid JSON.
- async tools.feature_atlas.load_features_to_falkor.load_features(features=None)[source]
MERGE every Feature into the atlas knowledge graph in FalkorDB.
This is Step 2 of the Feature Atlas pipeline: it turns the registry of discovered features into actual
Featurenodes in the graph so later steps (interaction detection, prompt generation, querying) have vertices to attach edges and analyses to. The whole operation is idempotent and safe to re-run, which is the contract callers and the orchestrator rely on.Opens a connection to the
stargazer_feature_interaction_atlasgraph viaget_atlas_graph(FalkorDB over the shared Redis connection pool), then MERGEs each feature throughmerge_featureand logs a per-feature line with its confidence and file/symbol counts. When nofeaturesargument is supplied it falls back toload_feature_registry(), readingoutputs/feature_registry.jsonfrom the local filesystem. Per-feature failures are logged and skipped rather than aborting the batch, and after the loop it runs a read-onlycount(Feature)query to log a verification total before closing the Redis client. Called byasync_main()in this module, which is dispatched as Step 2 byrun_atlas.py‘sstep_load_features(imported there asasync_main as run).- Parameters:
features (
list[dict[str,Any]] |None) – Optional pre-loaded list of feature dicts. WhenNone, the features are read fromoutputs/feature_registry.jsonviaload_feature_registry().- Returns:
The number of features successfully MERGEd into the atlas graph (features that raised during the merge are excluded from the count).
- Return type:
- async tools.feature_atlas.load_features_to_falkor.async_main()[source]
Run Step 2 end to end: load the registry and import features into FalkorDB.
This is the coroutine that actually performs the feature load for command-line and orchestrated runs. It reads the registry once for an accurate denominator, drives the FalkorDB import, and prints a human-readable summary so an operator can see how the step fared at a glance.
Reads
outputs/feature_registry.jsonviaload_feature_registry(), delegates the graph writes toload_features()(which connects to thestargazer_feature_interaction_atlasgraph in FalkorDB), times the run, and writes a formatted report to stdout. It is invoked both bymain()here (viaasyncio.run) and byrun_atlas.py‘sstep_load_features, which imports it asasync_main as runand awaits it directly.- Returns:
All output is side effects – the FalkorDB writes performed by
load_features()and the summary printed to stdout.- Return type:
- tools.feature_atlas.load_features_to_falkor.main()[source]
Synchronous CLI entry point for the Step 2 feature load.
Provides the
python -m tools.feature_atlas.load_features_to_falkorentry point so the feature load can be run standalone. It exists to bridge the synchronous shell invocation into the async pipeline and to make sure progress is visible on the console.Configures root logging at INFO level (so the per-feature load lines and the verification count emitted under
load_features()are shown), then runsasync_main()to completion viaasyncio.run. Called only from this module’sif __name__ == "__main__"guard; the orchestrated path inrun_atlas.pyawaitsasync_main()directly and does not go through this function.- Return type:
- Returns:
None.