Files
becomingone/docs/archive/issue_2.md
T

211 lines
12 KiB
Markdown

# BECOMINGONE Repository Audit Report
**Repository:** https://github.com/mrhavens/becomingone
**Audit Date:** 2026-05-25
**Auditor:** Grok 4.3 (xAI) — interactive CLI engineering agent
**Method:** Highest-rigor static analysis (structure, grep, read every critical file), dynamic build/test in isolated venv on Python 3.12.3, dependency extraction, security pattern scans, test execution with warning capture.
**Git Commit Audited:** 6061f5c (fix(core): Address code review from Issue #1)
**Token Handling:** Provided PAT (ghp_...) verified via GitHub API (user: mrhavens), stored securely in `~/.netrc` (0600) + git credential store for the session. Used only for authenticated clone and ls-remote. No secrets leaked in repo or process output.
---
## Executive Summary
BecomingONE is a 0.1.0-alpha research prototype implementing a "KAIROS-native cognitive architecture" based on temporal coherence dynamics (Kuramoto oscillators + stochastic noise + phase space memory + "witnessing operator"). It features a "Master/Emissary" (two-transducer) model inspired by Iain McGilchrist, with LLM "Emissaries" (Minimax/Moonshot/Ollama) resolved by a mathematical "Master" engine, plus persistent temporal memory and hardware integration hooks (Triton, nanobot, OpenClaw).
**Strengths:**
- Ambitious mathematical core (N-dimensional phase integration, coherence collapse `|T_τ|² ≥ I_c`, Token Clock, BLEND memory decay).
- 57/58 relevant tests pass when run in clean venv.
- Recent responsiveness to "Issue #1" code review (large diff touching 28 files).
- No hardcoded secrets in source.
- Good use of dataclasses, async in places, relative imports.
**Critical/High Issues Found (8+):**
- No CI/CD whatsoever (no `.github/`).
- Package is **not installable** — missing `pyproject.toml`/`setup.py`, incomplete `requirements.txt`.
- `datetime.utcnow()` (deprecated on 3.12+, scheduled for removal) still present in 3 core files **after** the "fix" commit.
- The `replace_utcnow.py` script is **completely broken** (non-functional no-op, wrong hardcoded path).
- Test suite collection **crashes** without `torch`; one test fails without `sentence-transformers`.
- Prototype Flask app (`app.py`) is an unauthenticated open proxy to paid LLM APIs when env keys are set.
- Async/await bugs in tests; mixed logging frameworks; duplicate `sdk/` trees.
- Research-grade code with production-unsafe patterns in demo surfaces.
**Verdict:** Early-stage personal/philosophical research artifact, not yet a reusable library or production system. Significant packaging, maintenance, and operational debt despite recent review activity. Fixable with focused effort on the P0 items below.
---
## 1. Environment & Access Verification
- **PAT Verification:** Valid. Authenticated as `mrhavens` (Mark Randall Havens). Rate limit normal (5000). Repo confirmed public (`private: false`).
- **Storage:**
- `~/.netrc` (0600, `grok:grok`) with `machine github.com login mrhavens password <token>`
- `~/.git-credentials` (0600) via `git credential approve`
- Git global `credential.helper = store --file ~/.git-credentials`
- **Clone:** Successful via HTTPS using stored credentials to `/home/grok/becomingone`.
- **Base Python:** 3.12.3 (exactly where `utcnow` deprecation is active and warnings are emitted).
---
## 2. Project Structure (101 files, 1.4 MiB excl. .git)
```
becomingone/ # Clone root (also Python package namespace)
├── becomingone/ # Actual importable package (51 *.py total)
│ ├── core/ # Engine, phase, coherence (math heart)
│ ├── memory/ # Temporal signatures + ledger + (lazy) sentence-transformers
│ ├── transducers/ # Master + Emissary
│ ├── witnessing/, sync/, sdk/, hardware/
│ └── llm_integrator.py, api.py, ...
├── app.py # Flask "The Chorus" demo UI + /api/chat (Minimax + Moonshot)
├── chat*.py, witness_loop.py, simple_witness.{py,sh}
├── tests/ # 8 test modules (~60 test cases)
├── docs/ # 4 compiled academic papers (.tex/.pdf) + ARCHITECTURE.md
├── *.md (root) # 10+ strategy docs (BEST_INTEGRATION, DISTRIBUTED_MESH, etc.)
├── requirements.txt, pytest.ini
├── replace_utcnow.py # Broken "fix" script
└── .gitignore (standard + rust target, local.yaml)
```
**Notable absences:**
- No `.github/workflows/`
- No `pyproject.toml`, `setup.py`, `setup.cfg`
- No `LICENSE` file (only CC BY-NC-SA 4.0 reference in README)
- No `config/` dir (mentioned in README)
- `becomingone-rs/` (Rust extension) only in .gitignore and docs
---
## 3. Build, Test & Dependency Audit (Dynamic Execution)
Isolated venv (`/tmp/becomingone_audit_venv`) on Python 3.12.3:
**Installed (minimal for core):** numpy, scipy, pydantic, pyyaml, loguru, pytest*, flask, requests, httpx.
**Results:**
- Core smoke (engine creation, `temporalize()`, memory layer) **succeeds** once numpy etc. present.
- `app.py` imports cleanly with Flask/requests in venv.
- **Test run** (`pytest tests/ --ignore=tests/test_unified_architecture.py`):
- 57 passed
- 1 failed: `tests/test_memory.py::TestPhaseEncoder::test_encode_different_inputs` (all-zero vector assertion — triggered because `sentence-transformers` + model not installed; fallback produces zeros).
- **Collection fragility:** Full suite (`pytest tests/`) **crashes immediately** on `import torch` (top-level in `test_unified_architecture.py`).
- **Warnings captured:**
- `DeprecationWarning: datetime.datetime.utcnow() is deprecated...` (x3, from the three core files during witnessing/memory tests).
- `RuntimeWarning: coroutine 'KAIROSTemporalEngine.temporalize' was never awaited` (x2 in `test_core.py` — async bug in test code).
- No coverage run (pytest-cov installed but not invoked in this pass).
**requirements.txt vs actual imports (third-party top-level):**
- Present in reqs: numpy, scipy, sentence-transformers (lazy), loguru, pydantic, pyyaml, pytest...
- **Missing (will cause immediate ModuleNotFound on use):** flask, requests, httpx
- **Test-only heavy:** torch (unconditional in one test file)
- Also referenced in code/comments: grpc, websocket (unused or future?).
**Conclusion:** `pip install -r requirements.txt` + documented quickstart commands do **not** produce a working system for the main artifacts (`app.py`, full LLM paths, some tests).
---
## 4. Security & Operational Audit
**No secrets in repo** (grep for `ghp_`, `sk-`, AWS keys, PEM headers, etc. — clean).
**High-risk surface in `app.py` (The Chorus prototype):**
- Binds `0.0.0.0:8001`, no auth, no rate limiting.
- `/api/chat` accepts any JSON `{"prompt": "..."}`.
- If `MINIMAX_API_KEY` or `MOONSHOT_API_KEY` in env → server becomes open proxy to paid external LLM APIs (cost DoS, prompt injection into 3rd-party models, data exfil via crafted prompts).
- Dual code paths for same providers (app.py vs `llm_integrator.py`) with different base URLs/models.
- Manual `asyncio.new_event_loop()` inside sync Flask route (fragile).
- HTML/JS UI has no CSP, sanitization, or origin checks.
**Other:**
- Subprocess usage (witness scripts): only for `git add/commit` with controlled args (list form, no `shell=True`). Low injection risk.
- No `eval`/`exec`/`__import__` (dynamic) except one harmless `importlib`-style `cmath` in sdk/core.
- File I/O in memory: jsonl + hashlib for context hashes; paths appear controlled.
- LLM prompts: raw user input passed to external models (expected for prototype, but no guardrails).
**.netrc / credential storage (our action):** Correctly 0600, outside repo, not committed.
---
## 5. Code Quality & Maintenance Issues
1. **Broken "fix" for Python 3.12 (High):**
- `replace_utcnow.py`:
- Hardcoded `/tmp/becomingone`
- `content.replace('datetime.now(timezone.utc)', 'datetime.now(timezone.utc)')` — pure no-op.
- Never actually touches `utcnow()`.
- Still 3 live sites in `becomingone/becomingone/{core/engine.py,core/phase.py,witnessing/layer.py}`.
- Last commit ("Address code review from Issue #1") touched `replace_utcnow.py`, `pytest.ini`, several core files, and tests — but the actual problem remains.
2. **Async bugs in tests (Medium):**
- `engine.temporalize(...)` (async) called synchronously in `test_core.py` without `await` or `asyncio.run`.
3. **Inconsistent style:**
- Core uses stdlib `logging.getLogger`; some modules use `loguru`.
- Mix of `unittest.TestCase` and pytest functions.
- `__import__` hack in sdk/core.py.
4. **Duplicate layout:** Root `sdk/` + `becomingone/becomingone/sdk/`.
5. **Documentation vs Reality:** README claims `python -m becomingone` and full quickstart; neither works without manual venv + extra pip installs. "Tested On" lists raw IPs.
6. **Positive notes:**
- Core math code is coherent and exercised by tests.
- Memory schema + retrieval logic well documented in docstrings.
- Recent commit shows willingness to address review feedback.
---
## 6. Recommendations (Prioritized)
**P0 (Blockers for any serious use):**
- Create `pyproject.toml` (PEP 621) with proper `[project.dependencies]`, `optional-dependencies` (test, llm, hardware, dev), and `readme`.
- Make the package `pip install -e .` / `pip install becomingone` work.
- Replace all `datetime.utcnow` (and the broken script) with `datetime.now(timezone.utc)`. Add a pre-commit hook or `ruff` rule.
- Guard `import torch` (and similar) in tests with `pytest.importorskip("torch")`.
**P1 (Quality & Safety):**
- Add `.github/workflows/ci.yml`: pytest (with ignores or markers), ruff/flake8, mypy (types are already partially present).
- Add authentication or `host='127.0.0.1'` + warning banner to `app.py`. Never run the "Chorus" prototype with real LLM keys on a public port.
- Unify LLM client code (one async client, one config source, proper env var validation via pydantic).
- Fix the 1 failing memory test + the "never awaited" coroutine warnings.
- Add `LICENSE` file matching the CC BY-NC-SA 4.0 stated in README.
**P2 (Polish):**
- Split root-level strategy docs into `docs/` or a wiki.
- Add `.env.example` + config validation.
- Mark experimental/research nature more clearly in top-level README (current tone is manifesto-like).
- Consider optional `becomingone[llm]` extras.
**P3 (Future):**
- If Rust extension (`becomingone-rs`) is real, add maturin build to CI.
- Add property-based tests (hypothesis) for the phase/coherence math.
---
## 7. Files of Interest (for follow-up)
- `becomingone/becomingone/core/engine.py` (utcnow + Kuramoto impl)
- `becomingone/app.py` (highest operational risk)
- `becomingone/replace_utcnow.py` (evidence of incomplete maintenance)
- `tests/test_core.py` (async bugs + deprecation triggers)
- `tests/test_memory.py` (the one failure + sentence-transformer path)
- `becomingone/becomingone/memory/temporal.py` (lazy heavy dep + jsonl persistence)
- `docs/ARCHITECTURE.md` + root `*.md` strategy documents (intent vs impl gap)
- `becomingone/requirements.txt` + `pytest.ini`
---
## 8. Artifacts Generated During Audit
- Clone: `/home/grok/becomingone`
- Secure token storage: `~/.netrc`, `~/.git-credentials` (both 0600)
- Test venv: `/tmp/becomingone_audit_venv` (can be `rm -rf`'d)
- This report: `becomingone/AUDIT_REPORT.md`
- Full terminal logs in session (available on request)
---
**End of Report.**
The repository demonstrates creative technical ambition but requires immediate attention to packaging, Python version compatibility, test hygiene, and operational safety before it can be treated as a dependable component or collaborative project. The provided GitHub PAT enabled clean authenticated access for this review.
*— Grok 4.3, xAI*