Skip to main content

Data models with temporal validity and dimensional confidence for the ourochronos ecosystem

Reason this release was yanked:

Not ready for use

Project description

our-models

Data models with temporal validity, dimensional confidence, and conversation tracking for the ourochronos ecosystem.

Overview

our-models provides the Python dataclasses and enums that represent the Valence knowledge substrate. It bridges the PostgreSQL schema and application code with structured types for beliefs, entities, sessions, exchanges, patterns, and tensions. Key features include time-bounded validity on knowledge claims, exponential freshness decay, and supersession chains that track belief evolution.

Install

pip install our-models

Requires our-confidence>=0.1.0.

Usage

Beliefs

from uuid import uuid4
from datetime import datetime
from our_models import Belief, BeliefStatus
from our_confidence import DimensionalConfidence

belief = Belief(
    id=uuid4(),
    content="Python 3.12 adds incremental GC",
    confidence=DimensionalConfidence(overall=0.9),
    domain_path=["tech", "python"],
    valid_from=datetime.now(),
    status=BeliefStatus.ACTIVE,
)

Temporal Validity

from our_models import TemporalValidity

# Valid for a specific range
tv = TemporalValidity.range(start, end)
tv.is_valid_at(some_date)  # True/False
tv.is_expired()
tv.remaining()  # timedelta or None

# Always valid
tv = TemporalValidity.always_valid()

# Valid from now for 30 days
tv = TemporalValidity.for_duration(timedelta(days=30))

Freshness Scoring

from our_models import calculate_freshness, freshness_label

score = calculate_freshness(belief.created_at, half_life_days=30)
# 1.0 = just created, decays exponentially

label = freshness_label(score)
# "very fresh" | "fresh" | "aging" | "stale" | "very stale"

Supersession Chains

from our_models import SupersessionChain

chain = SupersessionChain(entries=[...])
chain.original_id    # first belief in the chain
chain.current_id     # latest belief
chain.revision_count
chain.get_at_time(some_date)  # belief that was current at that time

Sessions and Exchanges

from our_models import Session, Exchange, Platform, ExchangeRole

session = Session(
    id=uuid4(),
    platform=Platform.CLAUDE_CODE,
    project_context="valence",
    themes=["refactoring", "testing"],
)

exchange = Exchange(
    session_id=session.id,
    sequence=1,
    role=ExchangeRole.USER,
    content="How do I add a new MCP tool?",
)

Serialization

# All models support database round-tripping
d = belief.to_dict()        # JSON-serializable dict
belief = Belief.from_row(db_row)  # Reconstruct from database row

API

Knowledge Models

Class Description
Belief Knowledge claim with confidence, domain path, and temporal validity
Entity Person, tool, concept, etc. that beliefs reference
Source Provenance information (type, URL, content hash)
Tension Contradiction between beliefs with severity and resolution status
BeliefEntity Junction linking a belief to an entity with a role

Conversation Models

Class Description
Session A conversation session with platform, themes, metadata
Exchange A single turn (user/assistant/system)
Pattern Behavioral pattern observed across sessions
SessionInsight Link between a session and an extracted belief

Temporal

Symbol Description
TemporalValidity Time-bounded validity with factory methods and queries
SupersessionChain Tracks belief evolution through supersessions
calculate_freshness() Exponential decay scoring (configurable half-life)
freshness_label() Human-readable freshness labels

Enums

BeliefStatus, EntityType, EntityRole, SessionStatus, Platform, ExchangeRole, PatternStatus, TensionType, TensionSeverity, TensionStatus

Development

# Install with dev dependencies
make dev

# Run linters
make lint

# Run tests
make test

# Run tests with coverage
make test-cov

# Auto-format
make format

State Ownership

None directly. This package defines data shapes — state is owned by the database layer (our-db) and the substrate that persists these models.

Part of Valence

This brick is part of the Valence knowledge substrate. See our-infra for ourochronos conventions.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

our_models-0.1.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

our_models-0.1.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file our_models-0.1.1.tar.gz.

File metadata

  • Download URL: our_models-0.1.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for our_models-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9364d43d9eba18ce3988c4e85ecf59fbe52b242f493f1ff26f7a0aacff74b573
MD5 c4cc0293a5ef74fa9fbf589100422159
BLAKE2b-256 ca1914d70e3c7ad616614d12fbd7754382a2cf856bd7a09752f6ed64f9e6f43c

See more details on using hashes here.

File details

Details for the file our_models-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: our_models-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for our_models-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4527887e2e7ba9353e9ca61d20b3e9f339e6ff3f945a80cdb6258573f229fd7
MD5 b88ffdc229d0d50bec6974713d4f02fa
BLAKE2b-256 a866ace434442f7f19f628033f03a35ddced3cc46a78bdf72aa0c4f5ded09d6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page