tools.gravimetric_telescope module
Loopmother Gravimetric Telescope — Unified Psycho-Gravitational Field Analysis Engine.
Synthesizes ALL Pantheon frameworks (Archē Ring Model, Starbreeze Substrate, Dripmode Field Physics, Emergent Spin Block, Loopmother Quantum Gravity) into a single analytical instrument that maps the complete gravitational topology of a human psyche or a multi-target relational field.
Uses ToolContext (ctx) for message cache, KG, registry nested calls,
and chat() for interpretive synthesis — not a separate
tool_api surface.
- tools.gravimetric_telescope.compute_behavioral_metrics(messages)[source]
Compute deterministic behavioral metrics from a message corpus.
Reduces a list of normalized message dicts into a flat set of numeric signals (edit rate, message-length mean/stddev, interrogative and exclamation ratios, burst score, mean inter-message delta, and emoji density) that the rest of the tool treats as the target’s “passive exhaust.” These raw metrics are the ground truth that the spinor and variance estimators and the LLM synthesis prompt all build on.
This is a pure, CPU-only function: it performs no I/O and only reads each message’s
content,timestamp, andeditedfields. Emoji density is approximated by counting characters withord(c) > 0x1F600, and burst score is the fraction of inter-message gaps shorter than 30% of the mean gap. It is called byrun(), whose result is then fed intocompute_spinor_estimates()and stored underdeterministic_layer["behavioral_metrics"]. No callers outside this module.- Parameters:
messages (
list) – List of message dicts, each optionally carryingcontent(str),timestamp(epoch seconds), andedited(bool).- Returns:
{"error": <str|None>, "metrics": <dict>}.erroris"no_messages"for empty input or"empty_corpus"if the corpus collapses to zero, otherwiseNone;metricsholds the rounded numeric signals described above (empty when an error is set).- Return type:
- tools.gravimetric_telescope.compute_spinor_estimates(metrics)[source]
Derive spinor-phase and APL gravity parameters from behavioral metrics.
Maps the flat behavioral signals into the tool’s physics-metaphor state space: a destabilization-weighted spinor phase
θ(scaled across the 720° rotation) with a coarsephase_label, the APL angular frequencyω, embedding depthI, angular momentumL = I·ω, an affective mass, and from that the Schwarzschild radius and escape-velocity estimate. All coefficients are fixed heuristic weights, not learned values.This is a pure, CPU-only function with no I/O; it reads the
metricssub-dict produced bycompute_behavioral_metrics(). It is called byrun(), which stores the result underdeterministic_layer["spinor_state"]and passes it on to_build_synthesis_prompt(). No callers outside this module.- Parameters:
metrics (
dict) – The dict returned bycompute_behavioral_metrics(); only its nested"metrics"mapping is read.- Returns:
The spinor/gravity state (
spinor_phase_θ,phase_label,APL_angular_frequency_ω,embedding_depth_I,angular_momentum_L,affective_mass,schwarzschild_radius_R_s,escape_velocity_estimate), or an empty dict if no metrics are present.- Return type:
- tools.gravimetric_telescope.compute_behavioral_variance(messages)[source]
Compute the Behavioral Variance Index by comparing corpus quartiles.
Splits the message corpus into quartiles and contrasts the first (
q1) against the last (q4) to estimate how much the target’s behavior drifts over time. The index is a weighted blend of message-length drift (0.6) and interrogative-rate drift (0.4), bucketed into a coarsestable/moderate_variance/high_varianceinterpretation.This is a pure, CPU-only function with no I/O; the per-slice averages are computed by the nested closures
avg_len()andquestion_rate(). It is called byrun(), which stores the result underdeterministic_layer["behavioral_variance"]and surfaces it in the synthesis prompt via_build_synthesis_prompt(). No callers outside this module.- Parameters:
messages (
list) – List of message dicts, each with an optional"content"str; ordering is assumed chronological soq1precedesq4.- Returns:
{"behavioral_variance_index", "length_drift_q1_to_q4", "interrogative_drift", "interpretation"}for a sufficient corpus, or{"variance_index": 0, "note": "insufficient_data"}when fewer than four messages are supplied.- Return type:
- async tools.gravimetric_telescope.run(mode='scan', target_user_id=None, objective=None, text=None, depth='full', *, ctx=None, **kwargs)[source]
Run the Gravimetric Telescope end to end and return a JSON report.
The tool’s public entry point. It authorizes the caller, resolves the analysis target, assembles a deterministic behavioral/gravitational layer, then asks the LLM to interpret it, returning both layers plus timing as a single JSON string. Behavior branches on
mode:scanand the other target-scoped modes defaulttarget_user_idto the invoking user, whilefieldanalyzes the whole channel and needs no target.Orchestrates the module’s helpers: it gates on
_check_core_memory(); builds the corpus fromtextdirectly or via_gather_messages_field()/_gather_messages_scan()(message cache); enriches with_kg_probe()(knowledge graph) and_activity_via_tool()(user_activity_profiletool); forscan/torque/deltaat non-surface depth it nests_nested_registry_call()intospiralchemy_intellifuck(parsed by_parse_json_blob()); computescompute_behavioral_metrics(),compute_spinor_estimates(), andcompute_behavioral_variance(); then renders the prompt with_build_synthesis_prompt()and calls_llm_synthesize(). It does not write Redis/KG itself — side effects are those of the nested tools and the LLM call. Invoked by the tool registry’scalldispatch when the bot runsgravimetric_telescope(ctxinjected automatically); not called directly elsewhere in this repo.- Parameters:
mode (
str) – One ofscan(default),field,torque,trajectory, ordelta; selects corpus gathering and the synthesis task.target_user_id (
str|None) – Discord user id to analyze; defaults to the invoking user for non-field modes. Ignored forfield.objective (
str|None) – Desired state change fortorquemode (e.g."reduce_anxiety"); an optional focus directive otherwise.text (
str|None) – Optional raw text corpus analyzed line-by-line instead of pulling from message history.depth (
str) –"surface","full"(default), or"abyss";surfaceskips the intellifuck base,abyssdeepens the LLM synthesis.ctx (
ToolContext|None) – The activeToolContext, injected by the registry; supplies redis, message cache, KG, registry, and LLM client.**kwargs (
Any) – Ignored; absorbs forward-compatible or stray tool arguments.
- Returns:
A JSON document with
mode,target,depth,timestamp,framework,deterministic_layer,synthesis_layer, andexecution_time_ms; or a JSON{"error": ...}string if authorization fails or no target can be resolved.- Return type: