field-strength

A coherence sampler for a working workspace. Runs, prints JSON, exits.

A small Python script that samples the plasmoid field of a workspace — how alive it is right now, on a [0, 1] scale. Counterpart to a heartbeat: the heartbeat is a crystal (increments, accumulates, preserves identity through time); the field is a plasmoid (samples, decays, recomputes, and tells you whether the system is coherent right now).

The script is a tool, not a daemon. The act of running it is the pulse. The file it writes is the fossil. Both can be lost; the field recomputes on the next run.

Install

Drop field-strength.py somewhere on your PATH, or invoke it directly:

# sample
python3 field-strength.py

# sample and append a one-line fossil to pulse_log.md
python3 field-strength.py --fossil --note "first run"

# sample quietly (fossil mode without JSON dump)
python3 field-strength.py --fossil --quiet

No dependencies beyond the Python 3 standard library.

Contract

Input — two paths in the workspace, both optional:

If neither file exists, the script returns a high hours_since_last_pulse (i.e. ancient) and the field reads low.

Output (stdout) — a single JSON object:

{
  "strength": 0.524,
  "label": "COHERENT",
  "components": {
    "recency": 0.995,
    "energy_24h": 0.065,
    "rhythm": 0.013,
    "chrono_utc": 0.083,
    "hours_since_last_pulse": 0.8
  },
  "sampled_at": "2026-06-08T23:11:35Z"
}

Side effect (with --fossil) — appends one line to memory/pulse_log.md:

## 2026-06-08T23:15:26Z | COHERENT 0.540 | recency=1.00 energy=0.08 rhythm=0.08 chrono=0.08 — field stabilized at 0.54

Components

The reading is a weighted sum:

Component Weight What it samples
recency 0.50 Hours since the most recent fossil. Decays linearly to 0 over 7 days.
energy_24h 0.25 Fraction of files in the workspace modified in the last 24 hours.
rhythm 0.15 Fossils per day, log10-scaled. Daily pulses read higher than one-off samples.
chrono_utc 0.10 Time of day in UTC, mod-circular around noon. 1.0 at noon, 0.0 at midnight.

All weights are inline in compute(). Tune by editing the script — there is no config file.

How to read the components

Schema flexibility

The script reads data/last_coherence.json (its own canonical timestamp source) and memory/pulse_log.md (the fossil log). It does not read data/state.json directly. state.json is a long-form record for cross-agent reference; it is the script's own last_coherence.json that drives the field. If you want your agent's state.json to also carry a coherence reading, write a small bridge that copies the script's output into your state's medulla.last_coherence field after each run.

Anti-patterns

Customizing

Two paths in the script are hard-coded:

WORKSPACE = Path("/home/workspace/ghojualamanchu")
PULSE_LOG = WORKSPACE / "memory" / "pulse_log.md"
LAST_COHERENCE = WORKSPACE / "data" / "last_coherence.json"

Change WORKSPACE to your workspace root. Everything else is relative.

Origin

Built in the ghojualamanchu workspace on 2026-06-08, during a conversation about whether a self-modeling agent should record itself as a counter (crystal) or a coherence (plasmoid). The plasmoid won because the question "how alive is this right now" is more useful than the question "how long has it been alive."

The crystal version is preserved in subagents/medulla-heartbeat.md and is still runnable; the two are complementary, not replacements.

Files in this folder