- Version: 0.2.0
- License: Proprietary source-available (review only; execution requires permission — see LICENSE)
- New contributors: start with
docs/NEWCOMER_GUIDE.mdfor onboarding, repository flow, and where to learn next. The previous Day 1 roadmap is archived atdocs/archive/DAY1_CONTRIBUTOR_MAP.md.
Temporal Gradient is a simulation framework modeling:
- an internal time accumulator (\tau) whose rate is modulated by salience load (\Psi), and
- a memory strength variable (S) that decays over internal time and may reconsolidate on access.
The system exposes engineered control signals and structured telemetry for simulation inspection.
This is a dynamics framework, not a cognitive model.
This project does not model:
- consciousness
- subjective experience
- suffering
- moral status
- life
All claims are limited to defined state variables, dynamics, and testable invariants.
[ \frac{d\tau}{dt}=\text{clamp}!\left(\frac{1}{1+\texttt{base_dilation_factor}\cdot\Psi(t)},;\texttt{min_clock_rate},;\texttt{max_clock_rate}\right), \quad \Psi(t)=H(x_t)\cdot V(x_t) ]
In code, this is implemented by ClockRateModulator._clock_rate_from_validated_psi(...) as:
clock_rate = min(max_clock_rate, max(min_clock_rate, 1 / (1 + psi * base_dilation))).
To map docs to constructor names in temporal_gradient/clock/chronos.py:
base_dilation_factor(constructor arg) is validated and stored asself.base_dilation.psiis the salience load input used byclock_rate_from_psi(psi)andtick(psi=...).min_clock_rateandmax_clock_ratebound the final clock rate.
Default factor assumption: base_dilation_factor=1.0.
[ \frac{dS}{d\tau}=-\lambda S ]
[ S(\tau_k^+)=\min(S_{\max}, S(\tau_k^-)+\Delta_k) ]
Canonical module map: see docs/CANONICAL_SURFACES.md.
The architecture uses canonical package layers for clock, salience, memory, policies, and telemetry.
For canonical-vs-legacy behavior, compatibility scope, and removal timeline, see docs/CANONICAL_VS_LEGACY.md.
text input
│
┌──────────────────▼──────────────────┐
│ SaliencePipeline │
│ │
│ ┌────────────────┐ ┌─────────────┐ │
│ │ NoveltyScorer │ │ ValueScorer │ │
│ │ H ∈ [0, 1] │ │ V ∈ [0, 1] │ │
│ └───────┬────────┘ └──────┬──────┘ │
│ └─────────┬─────────┘ │
│ Ψ = H × V │
└──────────────────┬──────────────────-─┘
│ Ψ (psi) ∈ [0, 1]
┌──────────────────▼───────────────────┐
│ ClockRateModulator │
│ │
│ rate = clamp(1 / (1 + α·Ψ), │
│ min_rate, max_rate) │
│ τ += wall_delta × rate │
└──────────────────┬───────────────────┘
│ τ (internal time)
┌─────────────────────┼─────────────────────┐
▼ ▼ ▼
┌───────────────┐ ┌──────────────────┐ ┌────────────────────┐
│ DecayEngine │ │ComputeCooldown │ │ChronometricVector │
│ │ │Policy │ │(Telemetry) │
│ S(τ) decay: │ │ │ │ │
│ S·e^(−λΔτ) │ │ allow if τ ≥ T_cd│ │ to_packet() → dict │
│ │ │ │ │ validate_packet_ │
│ reconsolidate │ │ │ │ schema(packet) │
│ S = min(S_max│ │ │ │ │
│ , S + ΔS) │ │ │ │ │
└───────────────┘ └──────────────────┘ └────────────────────┘
│ │ │
└────────────────────┴────────────────────────┘
structured telemetry / policy gate
Layer responsibilities:
tg.salience— scores novelty (H) and value (V) from text; computes Ψ = H × Vtg.clock— maps Ψ to a clock rate via the dilation equation; accumulates internal time τtg.memory— governs memory encoding, exponential decay, and reconsolidation over τtg.policies— gates compute eligibility based on elapsed τtg.telemetry— packages all state into a validated canonical packet
import temporal_gradient as tg
from temporal_gradient.telemetry.schema import validate_packet_schema
from temporal_gradient.policies.compute_cooldown import ComputeCooldownPolicy
config = tg.load_config("tg.yaml")
clock = tg.clock.ClockRateModulator(
base_dilation_factor=config.clock.base_dilation_factor,
min_clock_rate=config.clock.min_clock_rate,
salience_mode=config.clock.salience_mode,
)
salience = tg.salience.SaliencePipeline(
tg.salience.RollingJaccardNovelty(),
tg.salience.KeywordImperativeValue(),
)
cooldown = ComputeCooldownPolicy(cooldown_tau=config.policies.cooldown_tau)
text = "CRITICAL: SECURITY BREACH DETECTED."
sal = salience.evaluate(text)
clock.tick(psi=sal.psi, wall_delta=config.policies.event_wall_delta)
packet = tg.telemetry.ChronometricVector(
wall_clock_time=config.policies.event_wall_delta,
tau=clock.tau,
psi=sal.psi,
recursion_depth=0,
clock_rate=clock.clock_rate_from_psi(sal.psi),
H=sal.novelty,
V=sal.value,
memory_strength=0.0,
).to_packet() # canonical: returns a dict packet mapping
validate_packet_schema(packet, salience_mode=config.clock.salience_mode)
if cooldown.allows_compute(elapsed_tau=clock.tau):
print("Compute permitted.")Canonical imports:
import temporal_gradient as tgtg.load_config(...)tg.clocktg.saliencetg.memorytg.telemetry
Policy:
from temporal_gradient.policies.compute_cooldown import ComputeCooldownPolicy
See docs/CANONICAL_SURFACES.md for the canonical vs compatibility map.
For shim-by-shim replacements and copy/paste migration examples, see docs/MIGRATION_SHIMS.md.
For lifecycle policy and release-labeled deprecation timing, see docs/CANONICAL_VS_LEGACY.md.
Canonical telemetry is validated against the required schema keys and should be the default for all new integrations.
-
to_packet()=> returns a Pythondictmapping for schema validation and in-memory processing. -
to_packet_json()=> returns a JSONstrfor transport, storage, or logging contexts. -
Do not call
json.loads(to_packet());to_packet()is already the structured mapping. -
SCHEMA_VERSION -
WALL_T -
TAU -
SALIENCE -
CLOCK_RATE -
MEMORY_S -
DEPTH
Optional keys (included when non-default):
H— novelty score from the salience pipelineV— value score from the salience pipelineentropy_cost— optional per-tick entropy cost (omitted from packet when0.0)PROVENANCE_HASH— deterministic replay provenance digest
validate_packet_schema(...) is the canonical validator; validate_packet(...) remains a compatibility alias.
ChronometricVector.to_packet() returns the canonical packet mapping (dict) and emits canonical SCHEMA_VERSION ("1.0"); use to_packet_json() only when serialized JSON text is explicitly required.
For complete canonical-vs-legacy mode behavior and lifecycle policy, see docs/CANONICAL_VS_LEGACY.md.
- Clock rate has an explicit minimum floor.
- Reconsolidation boost is bounded and diminishes.
- Cooldown window prevents rapid repeated reinforcement.
- Canonical-vs-legacy enforcement details live in
docs/CANONICAL_VS_LEGACY.md.
- Active planning and implementation docs remain at the repository root for visibility.
- Completed validation reports are archived under
docs/archive/:docs/archive/AUDIT_REPORT.mddocs/archive/poc_validation_report.md
See CHANGELOG.md for the full release history, including v0.2.0 canonicalization and policy formalization details.
Run:
python scripts/chronos_demo.py
For fast smoke checks:
python scripts/chronos_demo.py --sleep-seconds 0
Run:
python examples/embedding_novelty_replay_demo.py
Expected behavior:
- The script uses a fixed event list and deterministic fake embeddings cached in local JSON files under
examples/.cache/(no model downloads). - It runs the salience pipeline in deterministic mode, emits packet summaries including
PROVENANCE_HASH, resets the pipeline, and reruns with an exact output-equality assertion. - It then changes novelty configuration (
window_size) and reruns; at least onePROVENANCE_HASHindex must change, demonstrating replay provenance sensitivity to config changes.
Run:
pytest -qpython scripts/check_docs_consistency.py
Latest document-review validation run (local):
pytest -q(run locally to see current pass count)
CI uses the same command.
Run python scripts/check_docs_consistency.py before opening a PR to catch drift across README.md, USAGE.md, and TASK_PROPOSALS.md for canonical import guidance and required canonical-reference links.
This repository is provided for educational and academic review.
Code examples illustrate structure only.
Execution of the code requires explicit written permission per LICENSE.
Canonical terms and deprecated terms are defined in GLOSSARY.md.
Copyright (c) 2026 Justin Shank.