Skip to content

fork sync - #17

Merged
erinepshovel-code merged 33 commits into
The-Interdependency:mainfrom
erinepshovel-code:main
May 4, 2026
Merged

erinepshovel-code merged 33 commits into
The-Interdependency:mainfrom
erinepshovel-code:main

Conversation

@erinepshovel-code

Copy link
Copy Markdown
Collaborator

post replit agent hallucination

erinepshovel-code and others added 30 commits February 17, 2026 16:58
Implements the complete Energy-Dissonance Circuit Model organizational
diagnostic package as described in the EDCM-PCNA specification.

Package structure (edcm-org/):
- src/edcm_org/: Full Python package with spec_version stamp, typed
  OutputEnvelope, and all 10 primary metrics (C, R, F, E, D, N, I, O, L, P)
- metrics/: primary (single-window), secondary (window-history F/E/I),
  progress sub-components, and extraction_helpers
- params/: alpha (persistence), delta_max (throughput ceiling), complexity
- basins/: taxonomy for all 7 basins + detect.py with explanation blocks
- governance/: privacy guard (ConsentError on individual output), gaming
  detection (non-optional), and non-punitive intervention recommendations
- eval/: spec compliance protocol with CI/CD-ready batch evaluation
- io/: loaders for .txt transcripts and .csv ticket data, JSON schema
- cli.py: wired analysis pipeline with governance enforcement

spec/:
- edcm-org-v0.1.md (formal specification)
- metric-glossary.md, evaluation-protocol.md, governance.md

tests/: 126 tests covering metric ranges, basin detection (all 7 basins),
privacy guard, and spec compliance (no individual outputs, range enforcement)

examples/: sample meeting transcript, ticket CSV, and demo shell script

README.md updated with EDCM + PCNA documentation.

All 126 tests pass. CLI smoke-tested on sample data.

https://claude.ai/code/session_01PvbiQrmTg6Hm1DbNzhCsab
…tation-0SuTj

Add EDCM-Org v0.1 package: full implementation, spec docs, and tests
spec.md: Engineering reference for the full a0 + edcm-org codebase.
Covers the A0 request/response contract, routing rules, adapter protocol,
tool interface, and all EDCM-Org spec details: metric catalog (C/R/D/N/L/O/F/E/I/P),
basin taxonomy with thresholds and confidence scores, parameter definitions,
governance rules, output envelope schema, pipeline order, and known v0.1 limitations.

suggest.md: Prioritized improvement backlog (P0–P3) grounded in actual code.
Covers marker frequency counting, hardcoded alpha/c_reduction, structured
gaming alerts, sentence-boundary windowing, adapter/tool stubs, multi-window
CLI support, and observability gaps.

https://claude.ai/code/session_01DaBkhxCJrBpQefHoDVR8qt
…es, tiers, provenance

Builds all 9 phases of the PTCA/PCNA architecture from scratch on top of
the existing a0 EDCM skeleton:

Phase 0: Rename hmm→hmmm; add fail-closed InvalidStateError enforcement at
         event-write and output-emission boundaries (invariants.py)

Phase 1: Guardian microkernel shell — emitter (sole outward human-readable
         emitter), audit boundary, 11-sentinel suite, recovery/quarantine shell;
         CLI ownership transferred to guardian/emitter.py

Phase 2: Tier system (Tier1 volatile / Tier2 committed) with blocked silent
         promotion; provenance.py hash-chain (SHA-256), events.jsonl sealing,
         provenance.json per task

Phase 3: Jury adjudication layer — conflict preservation, Tier2 gating,
         jury tokens, operative standard establishment

Phase 4: Memory continuity substrate — Jury-token-gated writes only;
         Memory ≠ logs enforced structurally

Phase 5: Private cores Phi, Psi, Omega (think, do not emit); Phonon
         internal transport (not display, not audit content); health
         sensing returns structural variance only

Phase 6: Meta-13 executive chooser — fast-path (12 raw sentinel witnesses)
         + slow-path (Meta-Phi/Psi/Omega stances); bandits do not choose

Phase 7: BanditAdvisor — bounded UCB1 advisory salience only; cannot
         override Meta-13, Jury, or Guardian sentinels; cannot authorize
         Tier2 writes or erase contested state

Phase 8: Guardian external-effect approval gate — blocks publish/post/send/
         push/spend/modify-secrets etc. without ApprovalToken; undoable
         internal work bypass conditions defined

Phase 9: Heartbeat maintenance-only cycle — integrity verify, snapshot
         refresh, bounded hygiene; prohibited actions raise
         HeartbeatViolationError

All 126 edcm-org tests pass. Smoke test passes.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
Append-only event log updated by smoke test runs during architecture
implementation — reflects the hmmm rename from hmm.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
Wires the claude-agent-sdk into a0 as the primary model adapter,
with PTCA roles mapped to AgentDefinition subagents:

- phi (opus, Read/Grep/Glob): private structural/analytic cognition
- psi (opus, Read/Grep/Glob): private semantic/contextual reasoning
- omega (sonnet, Read/Grep/Glob): private synthesis and integration
- jury (opus, Read/Grep/Glob): adjudication and conflict preservation
- bandit (haiku, Read/Grep): advisory salience ordering only

Tool restrictions enforce architectural laws directly:
- Law 1: private cores get read-only tools, no emit path
- Law 8: capability ≠ authority (Bandit cannot choose)
- Law 9: Guardian/parent agent is sole outward emitter
- Law 13: Meta-13 system prompt enforces that Bandit advises, Meta-13 decides

ClaudeAgentAdapter:
- Sync bridge via anyio.run() over async query()
- Mode-aware subagent selection (analyze/route/act)
- Graceful fallback to LocalEchoAdapter if SDK unavailable or CLI not running
- Passes mode and subagents_used through to event log

Router updated:
- _select_adapter() prefers ClaudeAgentAdapter when SDK available
- Falls back to LocalEchoAdapter otherwise
- Logs subagents_used per request

Also fixes top-level logging.py → _logging_legacy.py to stop it
shadowing stdlib logging (broke anyio/mcp imports).

126 edcm-org tests pass. Smoke test passes.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
…a=interdependent way

Psi tensors (a0/cores/psi/tensors/):
  The code to build a0 resides here. Routing, contract, tools, and
  adapters are semantic work — Psi's domain. Re-exports all a0 build
  modules so they are accessible as Psi's tensors without breaking
  existing import paths. psi.py → psi/ package.

Guardian UI (a0/guardian/ui/):
  Each tab is a circle. Seeds group circles. Guardian owns the UI (Law 10).
  7 seeds map directly to PTCA architecture:
    seed_core       → [phi, psi, omega]
    seed_transport  → [phonon]
    seed_jury       → [adjudication, conflicts, standards]
    seed_memory     → [continuity, recall]
    seed_meta       → [executive, fast_path, slow_path]
    seed_guardian   → [sentinels, recovery, approval, audit, emit]
    seed_advisory   → [bandit]
  Circle/Seed/SeedLayout dataclasses + default_layout() factory.
  Each seed subdirectory owns its circle definitions.

Omega tensors (a0/cores/omega/tensors/):
  The interdependent way and supporting material reside here.
  Omega synthesizes; its tensors are the framework and philosophy
  the whole system operates within.
    interdependent_way/ → ARCHITECTURAL_CENTER, FROZEN_CORE_STATEMENT,
                          CORE_LAWS (all 14), TIER_LAW, BANDIT_INFLUENCE_LAW,
                          HMMM_INVARIANT
    supporting/         → SPECS (ptca, edcm, a0), GLOSSARY
  omega.py → omega/ package.

126 edcm-org tests pass. Smoke test passes.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
Creates a0python/ as a clean-room repo that correctly implements the
PTCA v1.3.2 architecture from the start. Key differences from a0:

Structure:
- a0python/a0/cores/psi/tensors/   — CANONICAL home of a0 build logic
  contract.py, router.py, logging.py, model_adapter.py, tools/, adapters/
  (real modules, not re-exports from a top-level)
- a0python/a0/cores/omega/tensors/ — the interdependent way + supporting
  interdependent_way/{architecture,laws,hmmm}.py + supporting/{specs,glossary}.py
- a0python/a0/guardian/ui/app.py   — Textual A0App (NEW: TUI with seeds/circles)
  Seeds as TabbedContent panes; circles as rounded CircleWidget instances;
  HmmmBar shows global hmmm register; 7 seeds, 17 circles total
- a0python/a0/a0.py                — thin CLI entry, imports from psi tensors

All paths correct from the start:
  a0.cores.psi.tensors.contract    — A0Request / A0Response
  a0.cores.psi.tensors.router      — handle()
  a0.cores.omega.tensors           — THE_INTERDEPENDENT_WAY
  a0.guardian.ui                   — default_layout() / A0App

Verification:
  python -c "from a0.cores.psi.tensors import A0Request, handle"   → OK
  python -c "from a0.cores.omega.tensors import THE_INTERDEPENDENT_WAY" → OK
  python -c "from a0.guardian.ui import default_layout"             → OK
  python tests/test_smoke.py                                         → OK
  edcm-org: 126 tests pass

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
- a0python/a0/agent.py: AgentZero wraps handle() as single entry point
- a0python/a0/cores/psi/tensors/env.py: env tensor reads .env for
  A0_MODEL, ANTHROPIC_API_KEY, A0_PORT, A0_HOST
- a0python/a0/cores/psi/tensors/adapters/anthropic_adapter.py:
  direct Anthropic Messages API adapter (requires anthropic package)
- a0python/a0/cores/psi/tensors/router.py: _select_adapter() now
  env-driven (anthropic-api | claude-agent | local-echo)
- a0python/a0/guardian/ui/web/app.py: Gradio web app (guardian UI):
    chat tab — converse with AgentZero, hmmm register shown
    interdependentway.org tab — live iframe of the site
    settings tab — edit .env without restarting (model, API key, port)
- a0python/pyproject.toml: add gradio>=4.7, httpx>=0.27,
  python-dotenv>=1.0; a0-web script entrypoint
- a0python/run.sh: ./run.sh starts Gradio; ./run.sh --cli for TUI
- a0python/.env.example: documented configuration template
- a0python/.gitignore: add .env

Smoke test passes. AgentZero verified (local-echo adapter).

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
Adds emergent_adapter.py with commented implementation instructions
(OpenAI-compatible template). Router falls back to local-echo until
the endpoint is configured. .env.example documents EMERGENT_API_KEY
and EMERGENT_API_BASE vars.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
…tinel suite

Gap 1 — Local inference: OllamaAdapter (primary, zero new deps) and
LlamaCppAdapter (secondary, fully embedded) wired into router. External
API adapters (anthropic-api, claude-agent) untouched for training use.

Gap 2 — Multi-turn history: A0Request gains a history field; router
builds full message list from history + current turn; web UI passes
Gradio history through on each call.

Gap 3 — Tools: pdf_tool (pypdf), whisper_tool (openai-whisper), and
edcm_tool (edcm-org) all implemented with graceful stub fallback when
the optional dep is not installed.

Gap 4 — Sentinels 12/12: HmmmPresenceSentinel added; SentinelSuite
now runs all 12 sentinels as specified in the architecture.

pyproject.toml and .env.example updated to document new deps and vars.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
PCNA (inference engine layer):
- cores/pcna/inference.py: PatternMatchBackend (always on) + LlamaCppBackend
  (when A0_MODEL_PATH set); module-level singleton, lazy init
- cores/pcna/phi.py: structural analysis tensor field (constraint/negation/
  contradiction features → circular coords)
- cores/pcna/psi.py: semantic analysis tensor field (lexical diversity,
  question signal, semantic density → circular coords)
- cores/pcna/omega.py: synthesis tensor field (coherence, length, resolution
  features + model text when llama-cpp active)
- phi/psi/omega PrivateCore stubs now delegate to PCNA tensor fields

PCTA (circle tensor layer):
- cores/pcta/circle_tensors.py: transforms PCNA Cartesian state to circular
  coordinates via E → (|E|, arg(E)); CircleTensorState with unit_x/unit_y

PTCA (seed tensor routing lattice):
- cores/ptca/seed_router.py: 53-node lattice (49 compute + 4 sentinel);
  7 meta-routers × 7 seeds with {7/3} heptagram wiring; {7/2} sentinel
  scan schedule; G0 anchor separate from seed count
- seeds.py: push_pcta_state() feeds live circle tensor data into Guardian
  UI circles; register_live_callback() for external consumers

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
a0/encryption.py:
- Fernet (AES-128-CBC + HMAC-SHA256) wrapper
- Reads A0_MEMORY_KEY from env at import time (module-level singleton)
- encrypt(str) / decrypt(str) — transparent plaintext fallback when key
  is absent or cryptography package not installed
- decrypt() tolerates legacy plaintext files (safe migration path)

memory.py: encrypt JSON blob on _persist(), decrypt on _load()
logging.py: encrypt each event line before appending to .jsonl

env.py: expose A0_MEMORY_KEY; document generate command
.env.example: document A0_MEMORY_KEY with generate instructions
pyproject.toml: add [encryption] optional dep group (cryptography>=42)

Replit setup:
  1. python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
  2. Add output as A0_MEMORY_KEY in Replit Secrets
  3. pip install "a0python[encryption]"

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
a0/lifecycle.py:
- InstanceDescriptor: lightweight handle with home Path, instance_id,
  parent_id, config overrides, conflict list; persists to instance.json
- root_instance(): descriptor for the default package-root instance
- spawn(parent, name, seed_keys, config): child with optional memory seed;
  Jury-adjudicated transfer of selected keys from parent
- clone(source, name): exact copy (new id, shared initial state)
- merge(base, other, into): Jury-adjudicated memory union; Law 5 conflicts
  preserved as __base/__other/__conflict key triplets, never silently dropped
- diversify(parent, configs, seed_keys): N variants with different env
  overrides (A0_MODEL, etc.) from one parent
- list_instances(): discover all instances under state/instances/

Home-aware infrastructure (required for isolated instances):
- state.py: load_state/save_state accept optional home Path
- router.py: handle(req, home) uses home/logs and home state when set;
  renamed LOG_DIR → _DEFAULT_LOG_DIR
- agent.py: AgentZero(home, instance_id) stores both; passes home to handle()

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
state/ holds a0_state.json, memory.json, and lifecycle instance
directories — all generated at runtime, not source artifacts.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
…io settings, add training vars

- env.py now exports all 13 config vars (local model, emergent, encryption,
  server, training) and serves as the single source of truth
- encryption.py, inference.py, local_model_adapter.py wired to import
  from env.py — no direct os.getenv calls remain in those files
- encryption Fernet instance made lazy to avoid circular import at module
  load time (encryption ← env ← psi/tensors ← logging ← encryption)
- Gradio settings tab expanded: local model group, encryption group,
  training group; _save_settings() writes all 11 fields to .env
- .env.example documents A0_RUNTIME, A0_TRAINER_MODEL, A0_TRAINING_DIR
  for Path B (native PCNA) training with outside models

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
…emory)

soft_reset(instance) resets volatile state without touching committed memory:
- Clears a0_state.json → {"last_model": None}  (Tier 1 / volatile)
- Leaves memory.json intact  (Tier 2 / Jury-adjudicated)
- Leaves all logs intact  (sealed logs are append-only by architecture)
- Records reset_at timestamp in instance.json

Fifth lifecycle op alongside spawn / clone / merge / diversify.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
soft_reset (and any lifecycle op on the root instance) writes
a0/instance.json inside the package directory. This is runtime state,
not source — add to .gitignore alongside the other state files.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
…docs

- Separate PCNA / PCTA / PTCA with a clear three-tier table and section per layer
- PCNA: five tensor fields (phi, psi, omega, guardian, memory)
- PCTA: circle tensor / phase-coordinate spectral transform
- PTCA: 53-seed routing lattice (previously conflated as "PCNA")
- Add a0python/ repository layout covering all implemented modules
- Add configuration table for all 13 env vars
- Add lifecycle operations quick-reference (spawn, clone, merge, diversify, soft_reset)

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
…gulated Echo-state)

ZFAE is the Path B native PCNA engine — a reservoir computing / echo state
network whose 53-node topology mirrors the PTCA seed lattice:

Architecture:
  - 53-node reservoir: 49 compute (7 meta-groups × 7, {7:3} heptagram) +
    4 sentinel ({7:2} schedule) — spectral radius α < 1 enforces echo-state property
  - Input: phi + psi features (6-dim); output: omega features (3-dim readout)
  - Only W_out (readout) is trained; reservoir W_r is fixed by topology + alpha
  - Echo-state property: state is entirely determined by past inputs (no hidden
    intent, observable only — EDCM principle at architecture level)

Path B training:
  - A0_RUNTIME=training: router captures (state, omega_target) pairs from external
    model responses into A0_TRAINING_DIR/zfae_training.jsonl
  - ZFAEEngine.train_readout() fits W_out by least-squares (numpy if available,
    pure-Python gradient descent otherwise)
  - Activate: A0_MODEL=zfae (weights auto-loaded from A0_TRAINING_DIR if present)

Files:
  - a0/cores/pcna/zfae.py — ZFAEEngine (pure Python, no numpy at runtime)
  - a0/cores/pcna/inference.py — ZFAEBackend, get_backend() updated
  - a0/cores/psi/tensors/router.py — training capture hook
  - pyproject.toml — [zfae] optional dep (numpy for accurate lstsq)
  - README.md — ZFAE section with architecture + training workflow

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
Model registry (a0/model_registry.py):
- ModelConfig dataclass with all editable fields: adapter, model_name,
  max_tokens, temperature, system_prompt, phi/psi/omega/synthesis alphas,
  developer, description
- DEFAULT_REGISTRY module-level constant with built-in entries for
  claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5, llama3.2, zfae-v2,
  local-echo
- ModelRegistry CRUD: register, get, update (patch any field), remove,
  list_all, get_defaults_for(developer), save/load JSON
- make_complete_fn(registry, context) — aimmh-style callable factory;
  returns (model_id, messages) → A0Response; analogous to make_call_fn()
- ModelConfig.merge(overrides) for per-instance context layering

Context merging chain (lowest → highest priority):
  DEFAULT_REGISTRY[model_id] → InstanceDescriptor.config → per-call context

ZFAE v2 (a0/cores/pcna/zfae.py):
- ZFAEField class: one complete 53-node PTCA reservoir per cognitive field
- ZFAEEngine: four independent ZFAEField reservoirs
    phi_field    alpha=0.7  — structural features, short memory
    psi_field    alpha=0.9  — semantic features, longer memory
    omega_field  alpha=0.95 — synthesis-input features, longest memory
    synthesis    alpha=0.9  — 19-dim input aggregating all field summaries
                              + guardian, mem_long, mem_short proxies
- Synthesis proxy helpers: _proxy_guardian, _proxy_memory_long,
  _proxy_memory_short
- generate() gains memory kwarg; only synthesis W_out is trained
- save/load_weights v2 format (alphas + W_out, W_r/W_in reconstructed);
  backward-compat with v1 weight files
- compare_training_runs() and create_training_fleet() module helpers

Adapter updates:
- router.handle() gains registry= and context= kwargs; _resolve_model_config()
  implements the three-layer merge; _select_adapter() dispatched by
  config.adapter when set
- AnthropicAdapter(config=) reads model_name, max_tokens, temperature,
  system_prompt from ModelConfig
- ZFAEBackend(config=) and get_backend(config=) pass per-field alphas to
  ZFAEEngine
- README: Model Registry and ZFAE v2 sections

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
context_builder.py (new):
- build_memory_context(memory, base_system_prompt, include) → Optional[str]
- Reads all Tier 2 committed entries via Memory.all_keys() / .recall()
- Formats as "## Memory (Committed Continuity)\n{key}: {value}" block
- Prepends to any user-configured system_prompt, separated by blank line
- String values displayed as-is; complex values compact-JSON serialized
- include=False short-circuits to base_system_prompt (per-model opt-out)
- Read path requires no Jury token (Law 4 — reads are always permitted)

model_registry.py:
- Add ModelConfig.include_memory: bool = True
- Set include_memory=False for zfae-v2 (uses numeric proxies, not text)
  and local-echo (verbatim echo; no system prompt support)

router.py:
- Load Memory after model_config resolution (graceful — no-op on missing file)
- Call build_memory_context() to assemble effective system prompt
- Pass system_prompt=effective_system_prompt kwarg to adapter.complete()
  (None when nothing to inject — fully backwards-compatible)

anthropic_adapter.py:
- complete() checks kwargs.get("system_prompt") before self._system_prompt
- Per-call memory injection takes precedence over instance default

Result: every request is now grounded in the instance's committed memory.
Instances with no committed memory see no change in behaviour.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
guardian/user_db.py (new):
- UserRecord dataclass: user_id, username, passphrase_hash, affiliation_level,
  achievements, created_at
- AffiliationLevel IntEnum: GUEST(0) MEMBER(1) TRUSTED(2) OPERATOR(3)
- Passphrases stored as PBKDF2-HMAC-SHA256 (260 000 iters), never plaintext
  Constant-time verification via hmac.compare_digest
- Encrypted JSON persistence (state/users.json) via a0.encryption — same
  Fernet / AES-128-CBC pattern as memory.json
- Case-insensitive username lookup with username→user_id index
- API: register / verify / get / get_by_name / set_affiliation /
       add_achievement / remove_achievement / all_users / delete
- Errors: UserDBError, UserNotFoundError, UsernameTakenError, BadPassphraseError
- Accepts per-instance path (Path arg) for instance-scoped user tables
- FUTURE markers for Jury integration and routing wiring

guardian/__init__.py:
- Export UserDB, UserRecord, AffiliationLevel and all error types

Status: secondary — self-contained and tested; not yet wired into
router or Jury adjudication flow.

https://claude.ai/code/session_01TbNVoPaj5YneTSztxiPPPa
Normalize `hmmm` boundary, handle invalid JSON, and add adapter fallback with tests
Co-authored-by: erinepshovel-code <250928284+erinepshovel-code@users.noreply.github.com>
erinepshovel-code and others added 3 commits May 3, 2026 20:13
…he-interdependency-a0

Sync fork with upstream The-Interdependency/a0
Agent-Logs-Url: https://github.com/erinepshovel-code/a0/sessions/bdcdf3b3-a43e-4481-9b5c-01bcdf4abcf0

Co-authored-by: erinepshovel-code <250928284+erinepshovel-code@users.noreply.github.com>
…ase-structure

fix: rename Guardian → Θ (Theta) in pcna.py docstring
Copilot AI review requested due to automatic review settings May 4, 2026 03:36
@erinepshovel-code
erinepshovel-code merged commit 725ecdc into The-Interdependency:main May 4, 2026
3 of 4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to be a large “fork sync” that introduces/duplicates an a0 agent framework (CLI/router/guardian + hmmm contract enforcement), adds an edcm-org subpackage with governance/spec artifacts, and adds tests/scripts intended to validate boundary behaviors.

Changes:

  • Added/expanded the a0/ and a0python/a0/ implementations (contract, routing, guardian boundaries, state/memory, adapters/tools).
  • Added an edcm-org/ Python package (metrics/params/governance/schemas) plus spec docs and examples, with a duplicated copy under a0python/edcm-org/.
  • Added tests for hmmm boundary normalization and CLI invalid-JSON handling, plus various helper scripts/docs.

Reviewed changes

Copilot reviewed 227 out of 236 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tests/test_smoke.py Adds a CLI smoke script (currently not structured as a pytest test).
tests/test_hmmm_boundary.py Adds pytest coverage for hmmm normalization, dataclass enforcement, and CLI invalid-JSON behavior.
state.py Adds a minimal JSON-backed state helper (duplicate of a0/state.py).
skills/forking-structure-meta/SKILL.md Adds a skill document about extracting meta-lessons from branch/commit/test structure.
run.sh Adds a wrapper to run python -m a0.a0 (Termux-specific shebang).
router.py Adds a top-level router module (appears to be a broken/duplicate of a0/router.py).
python/engine/pcna.py Updates docstring terminology (“Guardian” → “Θ/theta”).
model_adapter.py Adds a simple ModelAdapter protocol + local echo adapter (top-level).
edcm-org/tests/test_privacy_guard.py Adds privacy guard tests for aggregation + PII scrubbing.
edcm-org/tests/test_no_individual_outputs.py Adds spec compliance tests to prevent individual-level outputs.
edcm-org/tests/init.py Test package marker.
edcm-org/src/edcm_org/spec_version.py Defines SPEC_VERSION.
edcm-org/src/edcm_org/params/delta_max.py Adds delta_max estimation logic.
edcm-org/src/edcm_org/params/complexity.py Adds complexity estimation + bucketing.
edcm-org/src/edcm_org/params/alpha.py Adds alpha estimation.
edcm-org/src/edcm_org/params/init.py Package docstring/overview.
edcm-org/src/edcm_org/metrics/progress.py Adds progress metric + subcomponents.
edcm-org/src/edcm_org/metrics/init.py Metrics package docstring/overview.
edcm-org/src/edcm_org/io/schemas.py Adds JSON schema for output envelope.
edcm-org/src/edcm_org/io/init.py I/O package docstring/overview.
edcm-org/src/edcm_org/governance/privacy.py Implements EDCMPrivacyGuard and PrivacyConfig.
edcm-org/src/edcm_org/governance/gaming.py Adds heuristic gaming detection alerts.
edcm-org/src/edcm_org/governance/init.py Governance package docstring/overview.
edcm-org/src/edcm_org/eval/init.py Eval package docstring/overview.
edcm-org/src/edcm_org/basins/init.py Basins package docstring/overview.
edcm-org/src/edcm_org/init.py Package metadata exports (SPEC_VERSION, __version__).
edcm-org/spec/metric-glossary.md Adds a metric glossary spec doc.
edcm-org/spec/governance.md Adds governance specification doc.
edcm-org/spec/evaluation-protocol.md Adds evaluation protocol spec doc.
edcm-org/pyproject.toml Adds packaging/test config for edcm-org.
edcm-org/examples/sample_tickets.csv Adds demo ticket dataset.
edcm-org/examples/sample_meeting.txt Adds demo meeting transcript.
edcm-org/examples/run_demo.sh Adds a demo runner script for edcm-org CLI.
contract.py Adds a top-level contract.py (currently contains a shell heredoc, not valid Python).
a0python/tests/test_smoke.py Adds a CLI smoke script under a0python layout.
a0python/run.sh Adds a launcher script for a0python web UI vs CLI mode.
a0python/pyproject.toml Adds packaging/deps for the a0python distribution.
a0python/edcm-org/tests/test_privacy_guard.py Duplicated edcm-org privacy guard tests under a0python vendored tree.
a0python/edcm-org/tests/test_no_individual_outputs.py Duplicated edcm-org “no individual outputs” tests under a0python vendored tree.
a0python/edcm-org/tests/init.py Test package marker (vendored copy).
a0python/edcm-org/src/edcm_org/spec_version.py Duplicated SPEC_VERSION (vendored copy).
a0python/edcm-org/src/edcm_org/params/delta_max.py Duplicated delta_max estimation (vendored copy).
a0python/edcm-org/src/edcm_org/params/complexity.py Duplicated complexity estimation (vendored copy).
a0python/edcm-org/src/edcm_org/params/alpha.py Duplicated alpha estimation (vendored copy).
a0python/edcm-org/src/edcm_org/params/init.py Duplicated package docstring (vendored copy).
a0python/edcm-org/src/edcm_org/metrics/progress.py Duplicated progress metric (vendored copy).
a0python/edcm-org/src/edcm_org/metrics/init.py Duplicated metrics docstring (vendored copy).
a0python/edcm-org/src/edcm_org/io/init.py Duplicated I/O docstring (vendored copy).
a0python/edcm-org/src/edcm_org/governance/privacy.py Duplicated privacy guard (vendored copy).
a0python/edcm-org/src/edcm_org/governance/gaming.py Duplicated gaming detection (vendored copy).
a0python/edcm-org/src/edcm_org/governance/init.py Duplicated governance docstring (vendored copy).
a0python/edcm-org/src/edcm_org/eval/init.py Duplicated eval docstring (vendored copy).
a0python/edcm-org/src/edcm_org/basins/init.py Duplicated basins docstring (vendored copy).
a0python/edcm-org/src/edcm_org/init.py Duplicated package metadata exports (vendored copy).
a0python/edcm-org/spec/metric-glossary.md Duplicated spec doc (vendored copy).
a0python/edcm-org/spec/governance.md Duplicated spec doc (vendored copy).
a0python/edcm-org/spec/evaluation-protocol.md Duplicated spec doc (vendored copy).
a0python/edcm-org/pyproject.toml Duplicated edcm-org packaging config (vendored copy).
a0python/edcm-org/examples/sample_tickets.csv Duplicated demo data (vendored copy).
a0python/edcm-org/examples/sample_meeting.txt Duplicated demo data (vendored copy).
a0python/edcm-org/examples/run_demo.sh Duplicated demo runner (vendored copy).
a0python/a0/tiers.py Adds tiered state types (Tier1/Tier2) + invariants.
a0python/a0/state/.gitkeep Keeps runtime state dir present.
a0python/a0/state/.gitignore Ignores runtime state files.
a0python/a0/state.py Adds load/save state with optional home override.
a0python/a0/meta13.py Adds Meta-13 executive chooser types/logic.
a0python/a0/memory.py Adds encrypted memory persistence + jury token enforcement.
a0python/a0/jury.py Adds adjudication layer with conflict preservation.
a0python/a0/invariants.py Adds require_hmmm invariant enforcement.
a0python/a0/heartbeat.py Adds bounded “maintenance-only” heartbeat cycle.
a0python/a0/guardian/ui/web/init.py Guardian web UI package marker.
a0python/a0/guardian/ui/seed_transport/init.py Defines Phonon UI circle.
a0python/a0/guardian/ui/seed_meta/init.py Defines Meta-13 UI circles.
a0python/a0/guardian/ui/seed_memory/init.py Defines Memory UI circles.
a0python/a0/guardian/ui/seed_jury/init.py Defines Jury UI circles.
a0python/a0/guardian/ui/seed_guardian/init.py Defines Guardian UI circles.
a0python/a0/guardian/ui/seed_core/init.py Defines core UI circles (phi/psi/omega).
a0python/a0/guardian/ui/seed_advisory/init.py Defines advisory (bandit) UI circle.
a0python/a0/guardian/ui/circles.py Defines the Circle dataclass for UI tabs.
a0python/a0/guardian/ui/init.py Exposes UI layout exports.
a0python/a0/guardian/recovery.py Adds quarantine/recovery shell.
a0python/a0/guardian/emitter.py Adds JSON emission with hmmm enforcement.
a0python/a0/guardian/audit.py Adds audit boundary enforcing invariants.
a0python/a0/guardian/approval_gate.py Adds external-effect approval gate.
a0python/a0/guardian/init.py Exposes guardian boundary exports (+ user_db exports).
a0python/a0/encryption.py Adds optional Fernet encryption with plaintext fallback.
a0python/a0/cores/ptca/init.py PTCA package exports.
a0python/a0/cores/psi/tensors/tools/whisper_tool.py Optional Whisper tool runner with stub fallback.
a0python/a0/cores/psi/tensors/tools/pdf_tool.py Optional PDF extraction tool runner with stub fallback.
a0python/a0/cores/psi/tensors/tools/edcm_tool.py EDCM tool runner (currently imports a missing run_pipeline).
a0python/a0/cores/psi/tensors/tools/init.py Tools package marker.
a0python/a0/cores/psi/tensors/model_adapter.py Defines ModelAdapter protocol + LocalEchoAdapter.
a0python/a0/cores/psi/tensors/logging.py Adds encrypted JSONL event logging with hmmm enforcement.
a0python/a0/cores/psi/tensors/env.py Central env var tensor loading (.env optional).
a0python/a0/cores/psi/tensors/contract.py Defines A0Request/A0Response contract for a0python pipeline.
a0python/a0/cores/psi/tensors/context_builder.py Builds system prompt context from Memory.
a0python/a0/cores/psi/tensors/adapters/local_model_adapter.py Adds Ollama + llama-cpp local model adapters.
a0python/a0/cores/psi/tensors/adapters/emergent_adapter.py Adds placeholder emergent adapter (NotImplemented).
a0python/a0/cores/psi/tensors/adapters/anthropic_adapter.py Adds Anthropic Messages API adapter.
a0python/a0/cores/psi/tensors/adapters/init.py Re-exports claude-agent adapter + subagents.
a0python/a0/cores/psi/tensors/init.py Exposes psi tensors exports for a0python.
a0python/a0/cores/psi/init.py Psi private core implementation.
a0python/a0/cores/phonon.py Phonon transport field implementation.
a0python/a0/cores/phi/init.py Phi private core implementation.
a0python/a0/cores/pcta/init.py PCTA package exports.
a0python/a0/cores/pcna/psi.py PCNA Psi tensor field implementation.
a0python/a0/cores/pcna/phi.py PCNA Phi tensor field implementation.
a0python/a0/cores/pcna/omega.py PCNA Omega tensor field implementation.
a0python/a0/cores/pcna/init.py PCNA exports.
a0python/a0/cores/omega/tensors/supporting/specs.py Adds spec catalog.
a0python/a0/cores/omega/tensors/supporting/glossary.py Adds glossary.
a0python/a0/cores/omega/tensors/supporting/init.py Exposes supporting exports.
a0python/a0/cores/omega/tensors/interdependent_way/laws.py Adds core laws/tier law/bandit influence law.
a0python/a0/cores/omega/tensors/interdependent_way/hmmm.py Adds hmmm invariant spec data.
a0python/a0/cores/omega/tensors/interdependent_way/architecture.py Adds architecture spec data.
a0python/a0/cores/omega/tensors/interdependent_way/init.py Exposes interdependent-way exports.
a0python/a0/cores/omega/tensors/init.py Omega tensors exports.
a0python/a0/cores/omega/init.py Omega private core implementation.
a0python/a0/cores/_base.py Base class for private cognitive cores.
a0python/a0/cores/init.py Exposes core exports.
a0python/a0/bandit.py Adds bandit advisory salience machinery.
a0python/a0/agent.py Adds AgentZero programmatic entrypoint.
a0python/a0/a0.py Adds a0python CLI entrypoint.
a0python/a0/init.py a0python package marker.
a0python/.gitignore Ignores local dev artifacts (.env, caches, state).
a0python/.env.example Adds example env config.
a0/tools/whisper_tool.py Adds stub whisper tool in a0 package.
a0/tools/pdf_tool.py Adds stub PDF tool in a0 package.
a0/tools/edcm_tool.py Adds stub EDCM tool in a0 package.
a0/tools/init.py Tools package marker.
a0/tiers.py Adds tiered state types (Tier1/Tier2).
a0/state/a0_state.json Adds committed runtime state JSON (should likely be ignored).
a0/state.py Adds load/save state helper.
a0/service/app.py Adds FastAPI app wrapper for hub payload handling.
a0/service/init.py Service package marker.
a0/router.py Adds router with adapter selection + tool dispatch + hmmm propagation.
a0/model_adapter.py Adds adapter protocol + LocalEchoAdapter.
a0/memory.py Adds memory persistence with jury-token enforcement (plaintext).
a0/logs/smoke1.jsonl Adds committed runtime logs (should likely be ignored).
a0/logging.py Adds event logging enforcing hmmm.
a0/invariants.py Adds require_hmmm invariant enforcement.
a0/heartbeat.py Adds bounded “maintenance-only” heartbeat cycle.
a0/guardian/ui/seed_transport/init.py Defines transport UI circle(s).
a0/guardian/ui/seed_meta/init.py Defines meta/executive UI circle(s).
a0/guardian/ui/seed_memory/init.py Defines memory UI circle(s).
a0/guardian/ui/seed_jury/init.py Defines jury UI circle(s).
a0/guardian/ui/seed_guardian/init.py Defines guardian UI circle(s).
a0/guardian/ui/seed_core/init.py Defines core UI circle(s).
a0/guardian/ui/seed_advisory/init.py Defines advisory UI circle(s).
a0/guardian/ui/circles.py Defines Circle dataclass.
a0/guardian/ui/init.py Exposes guardian UI layout exports.
a0/guardian/recovery.py Adds quarantine/recovery shell.
a0/guardian/emitter.py Adds JSON emission with invariant enforcement.
a0/guardian/audit.py Adds audit boundary enforcing invariants.
a0/guardian/approval_gate.py Adds external-effect approval gate.
a0/guardian/init.py Exposes guardian exports.
a0/cores/psi/tensors/init.py Re-exports canonical a0 build modules via psi tensors.
a0/cores/psi/init.py Adds Psi core stub implementation.
a0/cores/phonon.py Adds Phonon transport field implementation.
a0/cores/phi.py Adds Phi core stub implementation.
a0/cores/omega/tensors/supporting/specs.py Adds spec catalog.
a0/cores/omega/tensors/supporting/glossary.py Adds glossary.
a0/cores/omega/tensors/supporting/init.py Exposes supporting exports.
a0/cores/omega/tensors/interdependent_way/laws.py Adds core laws/tier law/bandit influence law.
a0/cores/omega/tensors/interdependent_way/hmmm.py Adds hmmm invariant spec data.
a0/cores/omega/tensors/interdependent_way/architecture.py Adds architecture spec data.
a0/cores/omega/tensors/interdependent_way/init.py Exposes interdependent-way exports.
a0/cores/omega/tensors/init.py Omega tensors exports.
a0/cores/omega/init.py Adds Omega core stub implementation.
a0/cores/_base.py Base class for private cognitive cores.
a0/cores/init.py Exposes core exports.
a0/contract.py Adds contract with normalize_hmmm + enforced boundary default.
a0/connectors/emergent_connector.py Adds hub payload → A0Request/A0Response translation.
a0/connectors/init.py Connectors package marker.
a0/bandit.py Adds bandit advisory salience machinery.
a0/adapters/openai_adapter.py Placeholder adapter module.
a0/adapters/local_adapter.py Placeholder adapter module.
a0/adapters/gemini_adapter.py Placeholder adapter module.
a0/adapters/init.py Exposes claude-agent adapter exports.
a0/a0.py Adds CLI entrypoint with structured invalid-JSON response.
a0/init.py a0 package marker.
a0/.gitignore Adds an (currently empty) ignore file under a0/.
_logging_legacy.py Adds legacy logging module copy (no invariant enforcement).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread a0/logs/smoke1.jsonl
Comment on lines +1 to +5
{"type": "request", "mode": "analyze", "tools_allowed": ["none"], "hmm": ["hmm"], "ts": "2026-02-17T18:02:41.004163+00:00"}
{"type": "model", "name": "local-echo", "ts": "2026-02-17T18:02:41.004496+00:00"}
{"type": "request", "mode": "analyze", "tools_allowed": ["none"], "hmmm": ["hmm"], "ts": "2026-03-21T04:42:31.480353+00:00"}
{"type": "model", "name": "local-echo", "hmmm": [], "ts": "2026-03-21T04:42:31.480622+00:00"}
{"type": "request", "mode": "analyze", "tools_allowed": ["none"], "hmmm": ["hmm"], "ts": "2026-03-21T04:43:36.404197+00:00"}
Comment on lines +12 to +18
try:
from edcm_org import run_pipeline # type: ignore[import]
result = run_pipeline(text)
return {"tool": "edcm", "status": "ok", "result": result}
except ImportError:
return {"tool": "edcm", "status": "stub", "input_chars": len(text),
"note": "install edcm-org to enable: pip install -e edcm-org/"}
Comment on lines +25 to +29
"spec_version": {
"type": "string",
"const": "edcm-org-v0.1.0",
"description": "Non-negotiable spec stamp."
},
Comment on lines +1 to +10
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "edcm-org"
version = "0.1.0"
description = "Energy-Dissonance Circuit Model — Organizational Diagnostic Package"
readme = "README.md"
license = { text = "MIT" }
Comment thread router.py
Comment on lines +8 to +11
from .contract import A0Request, A0Response
from .logging import log_event
from .state import load_state, save_state
from .model_adapter import ModelAdapter, LocalEchoAdapter
Comment thread run.sh
Comment on lines +1 to +2
#!/data/data/com.termux/files/usr/bin/bash
set -euo pipefail
Comment thread tests/test_smoke.py
Comment on lines +12 to +20
def main():
p = subprocess.run([sys.executable, "-m", "a0.a0"], input=json.dumps(REQ).encode("utf-8"), stdout=subprocess.PIPE, check=True)
out = json.loads(p.stdout.decode("utf-8"))
assert out["task_id"] == "smoke1"
assert "result" in out
print("OK")

if __name__ == "__main__":
main()
Comment thread contract.py
Comment on lines +1 to +3
cat > a0/contract.py <<'EOF'
# a0/contract.py
# hmmm: Contract is the stability anchor.
Comment thread a0/state/a0_state.json
Comment on lines +1 to +3
{
"last_model": "claude-agent"
} No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants