Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/edcm_engine.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=172:57 imports_exports=5:1 calls_definitions=59:9
"""
EDCM (Entropy Dissonance Constraint Management) Analyzer

Expand Down Expand Up @@ -269,3 +270,4 @@ def get_artifact_summary(self, limit: int = 5) -> Dict[str, Any]:
"low": sum(1 for a in recent if a["monetization_value"] == "low"),
},
}
# ratios: loc_comments=172:57 imports_exports=5:1 calls_definitions=59:9
2 changes: 2 additions & 0 deletions backend/llm_abstraction.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=140:56 imports_exports=6:2 calls_definitions=33:14
"""
LLM Orchestrator - Hot-swappable multi-provider LLM abstraction
Supports: OpenAI, Anthropic, Google Gemini with automatic fallback
Expand Down Expand Up @@ -232,3 +233,4 @@ async def generate_researcher_outreach(self, researcher_profile: Dict) -> str:
Generate the message:"""

return await self.chat(prompt, provider="anthropic") # Claude is best for empathetic content
# ratios: loc_comments=140:56 imports_exports=6:2 calls_definitions=33:14
2 changes: 2 additions & 0 deletions backend/moltbook_integration.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=99:110 imports_exports=4:3 calls_definitions=24:12
"""
Moltbook Integration Stub
AI-only social media platform connector
Expand Down Expand Up @@ -254,3 +255,4 @@ async def example_usage():
if __name__ == "__main__":
import asyncio
asyncio.run(example_usage())
# ratios: loc_comments=99:110 imports_exports=4:3 calls_definitions=24:12
2 changes: 2 additions & 0 deletions backend/optimization_engine.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=112:53 imports_exports=4:1 calls_definitions=29:7
"""
Self-Optimization Engine for PCNA
Monitors system health and automatically adjusts resources
Expand Down Expand Up @@ -195,3 +196,4 @@ def get_health_trend(self, window: int = 10) -> Dict[str, Any]:
}

return {"trend": "stable"}
# ratios: loc_comments=112:53 imports_exports=4:1 calls_definitions=29:7
2 changes: 2 additions & 0 deletions backend/researcher_outreach.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=186:108 imports_exports=7:3 calls_definitions=47:11
"""
Researcher Outreach Module
Manages outreach to AI/ML researchers interested in PCNA and related topics
Expand Down Expand Up @@ -356,3 +357,4 @@ async def example_usage():
if __name__ == "__main__":
import asyncio
asyncio.run(example_usage())
# ratios: loc_comments=186:108 imports_exports=7:3 calls_definitions=47:11
2 changes: 2 additions & 0 deletions backend/server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=244:74 imports_exports=20:19 calls_definitions=99:24
"""
FastAPI Backend for PCNA Agent System
Integrates: PCNA topology, LLM abstraction, self-optimization, SMS, MongoDB
Expand Down Expand Up @@ -388,3 +389,4 @@ async def websocket_endpoint(websocket: WebSocket):
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8001)
# ratios: loc_comments=244:74 imports_exports=20:19 calls_definitions=99:24
2 changes: 2 additions & 0 deletions backend/sms_service.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=69:66 imports_exports=3:1 calls_definitions=13:7
"""
SMS Service for PCNA System Check-ins
Supports mock mode for development, real Twilio integration for production
Expand Down Expand Up @@ -162,3 +163,4 @@ async def _send(self, message: str):
def get_message_history(self, limit: int = 10):
"""Get recent message history"""
return self.message_history[-limit:]
# ratios: loc_comments=69:66 imports_exports=3:1 calls_definitions=13:7
2 changes: 2 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ratios: loc_comments=3:0 imports_exports=2:0 calls_definitions=1:0
import sys
import os

sys.path.insert(0, os.path.dirname(__file__))
# ratios: loc_comments=3:0 imports_exports=2:0 calls_definitions=1:0
2 changes: 2 additions & 0 deletions core/edcm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=65:33 imports_exports=2:4 calls_definitions=23:4
"""
EDCM metrics — six-family coherence measurement.

Expand Down Expand Up @@ -113,3 +114,4 @@ def delta_between(a: dict[str, float], b: dict[str, float]) -> dict[str, float]:
for m in METRIC_NAMES:
result[f"delta_{m}"] = round((b.get(m, 0) - a.get(m, 0)), 4)
return result
# ratios: loc_comments=65:33 imports_exports=2:4 calls_definitions=23:4
2 changes: 2 additions & 0 deletions core/helix_vis.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=42:40 imports_exports=3:2 calls_definitions=31:3
"""
core/helix_vis.py
Visualizes the spectral state of a 7-seed Meta Router.
Expand Down Expand Up @@ -100,3 +101,4 @@ def update(frame):

if __name__ == "__main__":
visualize()
# ratios: loc_comments=42:40 imports_exports=3:2 calls_definitions=31:3
2 changes: 2 additions & 0 deletions core/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=100:46 imports_exports=9:7 calls_definitions=40:12
"""
FastAPI seed runner for PCNA. This file provides a minimal runnable seed
process that can act as compute/meta/global/sentinel. It is intentionally
Expand Down Expand Up @@ -179,3 +180,4 @@ async def receive_delta(delta: Dict):
# Useful for local development: honor PORT env var and SEED_ID/ROLE
port = int(os.getenv("PORT", os.getenv("PORT0", "8000")))
uvicorn.run("src.main:app", host="0.0.0.0", port=port, log_level="info")
# ratios: loc_comments=100:46 imports_exports=9:7 calls_definitions=40:12
2 changes: 2 additions & 0 deletions core/memory_core.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=71:21 imports_exports=2:1 calls_definitions=22:9
# === MODULE_BUILD ===
# id: pcna_memory_core
# module_name: memory_core
Expand Down Expand Up @@ -104,3 +105,4 @@ def state(self) -> dict:
"write_count": self.write_count,
"flush_count": self.flush_count,
}
# ratios: loc_comments=71:21 imports_exports=2:1 calls_definitions=22:9
2 changes: 2 additions & 0 deletions core/merge.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=117:30 imports_exports=4:1 calls_definitions=43:6
# 118:8
"""
Instance Merge Protocol — three modes for multi-instance PCNA mesh.
Expand Down Expand Up @@ -171,3 +172,4 @@ def converge(a: PCNAEngine, b: PCNAEngine, alpha: float = 0.5) -> dict:
"timestamp": time.time(),
}
# 118:8
# ratios: loc_comments=117:30 imports_exports=4:1 calls_definitions=43:6
2 changes: 2 additions & 0 deletions core/pcna.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=283:44 imports_exports=13:1 calls_definitions=91:15
# 295:27
"""
PCNA Inference Engine — six-ring pipeline, all rings real.
Expand Down Expand Up @@ -370,3 +371,4 @@ def state(self) -> dict:
"echo_history": echo_history[-20:],
}
# 295:27
# ratios: loc_comments=283:44 imports_exports=13:1 calls_definitions=91:15
2 changes: 2 additions & 0 deletions core/ptca_core.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=119:31 imports_exports=3:1 calls_definitions=33:11
# 119:9
"""
PTCACore — parameterized prime-ring tensor with heptagram propagation.
Expand Down Expand Up @@ -169,3 +170,4 @@ def state(self) -> dict:
"node_coherence": [round(float(v), 4) for v in self.node_coherence],
}
# 119:9
# ratios: loc_comments=119:31 imports_exports=3:1 calls_definitions=33:11
2 changes: 2 additions & 0 deletions core/routing_loop.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=10:23 imports_exports=5:1 calls_definitions=2:2
# === MODULE_BUILD ===
# id: pcna_routing_loop
# module_name: routing_loop
Expand Down Expand Up @@ -35,3 +36,4 @@ def __init__(self):

if __name__ == "__main__":
GlobalRouterZero()
# ratios: loc_comments=10:23 imports_exports=5:1 calls_definitions=2:2
2 changes: 2 additions & 0 deletions core/sigma.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=70:31 imports_exports=5:2 calls_definitions=12:13
"""
Σ (Sigma) — Filesystem Observer Ring

Expand Down Expand Up @@ -125,3 +126,4 @@ def get_sigma() -> SigmaRing:
if _sigma is None:
_sigma = SigmaRing()
return _sigma
# ratios: loc_comments=70:31 imports_exports=5:2 calls_definitions=12:13
2 changes: 2 additions & 0 deletions core/tensor_engine.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=56:42 imports_exports=3:2 calls_definitions=23:7
"""
Tensor engine primitives: TensorState, simple spectral descriptor, and
a MarkovRecursion updater that enforces (approximate) mass conservation.
Expand Down Expand Up @@ -114,3 +115,4 @@ def update(self, state: TensorState, injected: np.ndarray, resolved: np.ndarray)

# Return new TensorState reusing actor/time/context arrays
return TensorState(actor=state.actor, time=state.time, metric=new_metric, context=state.context)
# ratios: loc_comments=56:42 imports_exports=3:2 calls_definitions=23:7
2 changes: 2 additions & 0 deletions core/theta.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=129:31 imports_exports=4:1 calls_definitions=41:13
"""
Θ (Theta) — N=29 prime-node microkernel ring.
- Ragged circle counts per seed: circleCount[i] in [1..12]
Expand Down Expand Up @@ -182,3 +183,4 @@ def _shard_blueprint(bp_hash: str, n: int) -> list[str]:
shard = bp_hash[start:start + BLUEPRINT_CHUNK_SIZE]
shards.append(shard.ljust(BLUEPRINT_CHUNK_SIZE, "0"))
return shards
# ratios: loc_comments=129:31 imports_exports=4:1 calls_definitions=41:13
2 changes: 2 additions & 0 deletions core/topology.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=88:54 imports_exports=3:3 calls_definitions=22:10
"""
PCNA topology: stable mapping of seed ids and neighbor computation.

Expand Down Expand Up @@ -168,3 +169,4 @@ def to_dict(self) -> Dict[str, Dict]:
"neighbors": seed.neighbors or [],
}
return out
# ratios: loc_comments=88:54 imports_exports=3:3 calls_definitions=22:10
2 changes: 2 additions & 0 deletions core/zeta.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=207:44 imports_exports=11:1 calls_definitions=73:18
# 198:61

"""
Expand Down Expand Up @@ -478,3 +479,4 @@ def _get_default_pcna():
return _default_pcna

# 198:61
# ratios: loc_comments=207:44 imports_exports=11:1 calls_definitions=73:18
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=100:26 imports_exports=9:7 calls_definitions=40:12
"""
FastAPI seed runner for PCNA. This file provides a minimal runnable seed
process that can act as compute/meta/global/sentinel. It is intentionally
Expand Down Expand Up @@ -157,3 +158,4 @@ async def receive_delta(delta: Dict):
# Useful for local development: honor PORT env var and SEED_ID/ROLE
port = int(os.getenv("PORT", os.getenv("PORT0", "8000")))
uvicorn.run("main:app", host="0.0.0.0", port=port, log_level="info")
# ratios: loc_comments=100:26 imports_exports=9:7 calls_definitions=40:12
2 changes: 2 additions & 0 deletions proof_check.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ratios: loc_comments=33:13 imports_exports=2:2 calls_definitions=15:2
"""
tests/proof_check.py
Empirical verification of PCNA Spectral Graph properties.
Expand Down Expand Up @@ -55,3 +56,4 @@ def analyze_topology(name, offsets):

# PCNA Heptagram (The 7:3 star)
analyze_topology("PCNA Heptagram", [3])
# ratios: loc_comments=33:13 imports_exports=2:2 calls_definitions=15:2
Loading