algo-cli-runtime 0.14.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. algo_cli/__init__.py +3 -0
  2. algo_cli/__main__.py +7 -0
  3. algo_cli/_internal/__init__.py +12 -0
  4. algo_cli/_internal/policy_chain.py +259 -0
  5. algo_cli/action_registry.py +1047 -0
  6. algo_cli/agent_blocks.py +550 -0
  7. algo_cli/agent_pipeline.py +1457 -0
  8. algo_cli/agent_threads.py +308 -0
  9. algo_cli/animations.py +316 -0
  10. algo_cli/cache_admission.py +209 -0
  11. algo_cli/capability_mask.py +66 -0
  12. algo_cli/chat_protocol.py +116 -0
  13. algo_cli/chatgpt_auth.py +510 -0
  14. algo_cli/chatgpt_client.py +657 -0
  15. algo_cli/code_rag.py +479 -0
  16. algo_cli/config.py +651 -0
  17. algo_cli/context_budget.py +679 -0
  18. algo_cli/credential_helpers.py +315 -0
  19. algo_cli/deliberation.py +29 -0
  20. algo_cli/display.py +1470 -0
  21. algo_cli/evals/__init__.py +21 -0
  22. algo_cli/evals/algorithm_effectiveness.py +560 -0
  23. algo_cli/evals/competitive_harness_rating.py +702 -0
  24. algo_cli/evals/cot_quality.py +220 -0
  25. algo_cli/evals/harness_retrieval_benchmark.py +401 -0
  26. algo_cli/evals/performance_regression.py +136 -0
  27. algo_cli/evals/scorecard_grading.py +308 -0
  28. algo_cli/evals/session_distribution.py +84 -0
  29. algo_cli/execution_guardrails.py +806 -0
  30. algo_cli/extensions_manifest.py +84 -0
  31. algo_cli/git_evidence.py +227 -0
  32. algo_cli/google_workspace.py +407 -0
  33. algo_cli/google_workspace_auth.py +523 -0
  34. algo_cli/harness.py +2587 -0
  35. algo_cli/identity.py +557 -0
  36. algo_cli/index_compute_lab.py +228 -0
  37. algo_cli/inference_harness.py +70 -0
  38. algo_cli/intelligence/__init__.py +1103 -0
  39. algo_cli/intelligence/acrobat_config.py +307 -0
  40. algo_cli/intelligence/acrobat_manifests.py +338 -0
  41. algo_cli/intelligence/acrobat_models.py +195 -0
  42. algo_cli/intelligence/acrobat_pipeline.py +295 -0
  43. algo_cli/intelligence/acrobat_runtime.py +302 -0
  44. algo_cli/intelligence/acrobat_security.py +261 -0
  45. algo_cli/intelligence/acrobat_workflows.py +226 -0
  46. algo_cli/intelligence/actionability.py +165 -0
  47. algo_cli/intelligence/adversarial_audit.py +136 -0
  48. algo_cli/intelligence/agent_arena.py +92 -0
  49. algo_cli/intelligence/agent_benchmark.py +236 -0
  50. algo_cli/intelligence/agent_runtime.py +171 -0
  51. algo_cli/intelligence/agents_as_tools.py +70 -0
  52. algo_cli/intelligence/artifact_binding.py +80 -0
  53. algo_cli/intelligence/autonomous_engineer.py +1976 -0
  54. algo_cli/intelligence/backpressure.py +99 -0
  55. algo_cli/intelligence/bloom_filter.py +186 -0
  56. algo_cli/intelligence/bonferroni.py +66 -0
  57. algo_cli/intelligence/boundary_compaction.py +98 -0
  58. algo_cli/intelligence/catalog_verifier.py +172 -0
  59. algo_cli/intelligence/cavecrew.py +118 -0
  60. algo_cli/intelligence/changelog.py +176 -0
  61. algo_cli/intelligence/checkpoint_resume.py +92 -0
  62. algo_cli/intelligence/circuit_breaker.py +88 -0
  63. algo_cli/intelligence/clarification_gate.py +101 -0
  64. algo_cli/intelligence/code_graph.py +180 -0
  65. algo_cli/intelligence/coderank.py +97 -0
  66. algo_cli/intelligence/consistent_hash.py +150 -0
  67. algo_cli/intelligence/consortium_synthesis.py +139 -0
  68. algo_cli/intelligence/construction/__init__.py +241 -0
  69. algo_cli/intelligence/construction/common.py +273 -0
  70. algo_cli/intelligence/construction/documents.py +496 -0
  71. algo_cli/intelligence/construction/labor_units.py +1395 -0
  72. algo_cli/intelligence/construction/payments.py +470 -0
  73. algo_cli/intelligence/construction/risk.py +784 -0
  74. algo_cli/intelligence/content_extractor.py +132 -0
  75. algo_cli/intelligence/context_adaptive.py +102 -0
  76. algo_cli/intelligence/context_ops.py +95 -0
  77. algo_cli/intelligence/count_min.py +145 -0
  78. algo_cli/intelligence/cow_state.py +103 -0
  79. algo_cli/intelligence/critic_loop.py +119 -0
  80. algo_cli/intelligence/cross_source.py +113 -0
  81. algo_cli/intelligence/daemon_mode.py +99 -0
  82. algo_cli/intelligence/dag_orchestration.py +151 -0
  83. algo_cli/intelligence/deep_research.py +155 -0
  84. algo_cli/intelligence/degenerate_detector.py +78 -0
  85. algo_cli/intelligence/delta_report.py +92 -0
  86. algo_cli/intelligence/discovery_event_log.py +92 -0
  87. algo_cli/intelligence/document_ingest.py +298 -0
  88. algo_cli/intelligence/dual_layer_validate.py +151 -0
  89. algo_cli/intelligence/echo_fidelity.py +73 -0
  90. algo_cli/intelligence/ema_tuning.py +104 -0
  91. algo_cli/intelligence/event_log.py +92 -0
  92. algo_cli/intelligence/evidence_graph.py +114 -0
  93. algo_cli/intelligence/extension_host.py +162 -0
  94. algo_cli/intelligence/extension_manifest.py +115 -0
  95. algo_cli/intelligence/falsification_suite.py +178 -0
  96. algo_cli/intelligence/finance/__init__.py +169 -0
  97. algo_cli/intelligence/finance/anomalies.py +135 -0
  98. algo_cli/intelligence/finance/ap_ar.py +351 -0
  99. algo_cli/intelligence/finance/cash.py +162 -0
  100. algo_cli/intelligence/finance/close.py +332 -0
  101. algo_cli/intelligence/finance/common.py +244 -0
  102. algo_cli/intelligence/finance/construction.py +135 -0
  103. algo_cli/intelligence/finance/controls.py +172 -0
  104. algo_cli/intelligence/finance/evidence.py +119 -0
  105. algo_cli/intelligence/finance/exceptions.py +157 -0
  106. algo_cli/intelligence/finance/reconciliations.py +254 -0
  107. algo_cli/intelligence/finance/revenue.py +109 -0
  108. algo_cli/intelligence/finance/tax.py +74 -0
  109. algo_cli/intelligence/finance/workpapers.py +111 -0
  110. algo_cli/intelligence/finding_record.py +120 -0
  111. algo_cli/intelligence/flow_dag.py +267 -0
  112. algo_cli/intelligence/gatherer.py +223 -0
  113. algo_cli/intelligence/golden_master.py +98 -0
  114. algo_cli/intelligence/graph_rag.py +195 -0
  115. algo_cli/intelligence/group_chat.py +143 -0
  116. algo_cli/intelligence/hash_dedup.py +145 -0
  117. algo_cli/intelligence/hyperloglog.py +128 -0
  118. algo_cli/intelligence/incremental_index.py +316 -0
  119. algo_cli/intelligence/index_store.py +16 -0
  120. algo_cli/intelligence/iteration_plan.py +133 -0
  121. algo_cli/intelligence/kernel_plugins.py +167 -0
  122. algo_cli/intelligence/lesson_catalog.py +135 -0
  123. algo_cli/intelligence/llm_fallback.py +169 -0
  124. algo_cli/intelligence/log2_histogram.py +267 -0
  125. algo_cli/intelligence/lsp_integration.py +147 -0
  126. algo_cli/intelligence/memory_evolution.py +117 -0
  127. algo_cli/intelligence/minhash_lsh.py +182 -0
  128. algo_cli/intelligence/multi_model_score.py +174 -0
  129. algo_cli/intelligence/multi_tier_grade.py +211 -0
  130. algo_cli/intelligence/negative_controls.py +113 -0
  131. algo_cli/intelligence/numeric_clamp.py +63 -0
  132. algo_cli/intelligence/occ_editor.py +66 -0
  133. algo_cli/intelligence/output_normalize.py +112 -0
  134. algo_cli/intelligence/parallel_delegation.py +98 -0
  135. algo_cli/intelligence/parallel_fanout.py +104 -0
  136. algo_cli/intelligence/permission_modes.py +105 -0
  137. algo_cli/intelligence/pre_push_gate.py +68 -0
  138. algo_cli/intelligence/prefetch.py +171 -0
  139. algo_cli/intelligence/process_framework.py +217 -0
  140. algo_cli/intelligence/project_graph.py +387 -0
  141. algo_cli/intelligence/query_expansion.py +146 -0
  142. algo_cli/intelligence/ralph_loop.py +117 -0
  143. algo_cli/intelligence/rate_limiter.py +153 -0
  144. algo_cli/intelligence/refactor_transaction.py +94 -0
  145. algo_cli/intelligence/research_workspace.py +108 -0
  146. algo_cli/intelligence/retraction_ledger.py +72 -0
  147. algo_cli/intelligence/saga_pattern.py +88 -0
  148. algo_cli/intelligence/session_fork.py +100 -0
  149. algo_cli/intelligence/shadow_editor.py +67 -0
  150. algo_cli/intelligence/shell_session.py +213 -0
  151. algo_cli/intelligence/source_registry.py +143 -0
  152. algo_cli/intelligence/spawn_scales.py +99 -0
  153. algo_cli/intelligence/stat_stability.py +104 -0
  154. algo_cli/intelligence/structural_validator.py +148 -0
  155. algo_cli/intelligence/subagent_spawner.py +111 -0
  156. algo_cli/intelligence/symmetric_verify.py +70 -0
  157. algo_cli/intelligence/task_classifier.py +129 -0
  158. algo_cli/intelligence/team_execution.py +122 -0
  159. algo_cli/intelligence/tiered_access.py +121 -0
  160. algo_cli/intelligence/utility_registry.py +159 -0
  161. algo_cli/intuition_engine.py +560 -0
  162. algo_cli/intuition_injector.py +82 -0
  163. algo_cli/kernels/__init__.py +5 -0
  164. algo_cli/kernels/manifest.py +763 -0
  165. algo_cli/main.py +3903 -0
  166. algo_cli/memory_candidates.py +541 -0
  167. algo_cli/memory_echo_veil.py +394 -0
  168. algo_cli/memory_runtime.py +112 -0
  169. algo_cli/model_info.py +548 -0
  170. algo_cli/model_profile.py +160 -0
  171. algo_cli/model_routing.py +74 -0
  172. algo_cli/oneshot.py +331 -0
  173. algo_cli/perf_telemetry.py +389 -0
  174. algo_cli/plugins.py +245 -0
  175. algo_cli/private_event_store.py +654 -0
  176. algo_cli/quantization/__init__.py +24 -0
  177. algo_cli/quantization/lloyd_max.py +98 -0
  178. algo_cli/quantization/turbo_quant.py +308 -0
  179. algo_cli/reasoning/__init__.py +46 -0
  180. algo_cli/reasoning/combinatorial.py +356 -0
  181. algo_cli/reasoning/graph_of_thought.py +297 -0
  182. algo_cli/reasoning/mcts.py +220 -0
  183. algo_cli/reasoning/neuro_symbolic.py +250 -0
  184. algo_cli/reasoning/react.py +246 -0
  185. algo_cli/reasoning/reflexion.py +225 -0
  186. algo_cli/reasoning/tree_of_thought.py +241 -0
  187. algo_cli/reasoning_bridge.py +150 -0
  188. algo_cli/reconciliation.py +284 -0
  189. algo_cli/reflex.py +385 -0
  190. algo_cli/resources/docs/ALGO.md +13958 -0
  191. algo_cli/resources/docs/algo-cli-algorithm-evidence-contract.md +60 -0
  192. algo_cli/resources/docs/algo-cli-execution-verification-contract.md +59 -0
  193. algo_cli/resources/docs/algo-cli-memory-lifecycle-contract.md +72 -0
  194. algo_cli/resources/docs/harness-extension-cleanup-recommendation.md +41 -0
  195. algo_cli/resources/docs/index-compute-lab-integration.md +32 -0
  196. algo_cli/resources/docs/inference-harness-loop-blueprint-2026-06.md +55 -0
  197. algo_cli/resources/docs/main-split-map.md +35 -0
  198. algo_cli/resources/docs/privacy-and-context.md +48 -0
  199. algo_cli/resources/docs/reflex-loop-v0.2.md +354 -0
  200. algo_cli/resources/skills/README.md +26 -0
  201. algo_cli/resources/skills/algo-cli.md +59 -0
  202. algo_cli/resources/skills/edit-file-precision.md +49 -0
  203. algo_cli/resources/skills/harness-search-first.md +47 -0
  204. algo_cli/resources/skills/memory-recall-ritual.md +51 -0
  205. algo_cli/resources/skills/qol-algorithms.md +224 -0
  206. algo_cli/resources/skills/smart-error-recovery.md +56 -0
  207. algo_cli/resources/skills/tool-selection-cheatsheet.md +65 -0
  208. algo_cli/retrieval_algorithms.py +127 -0
  209. algo_cli/runtime_qos.py +236 -0
  210. algo_cli/runtime_services.py +320 -0
  211. algo_cli/session_commands.py +95 -0
  212. algo_cli/session_mode.py +113 -0
  213. algo_cli/skills.py +430 -0
  214. algo_cli/slash_dispatch.py +1265 -0
  215. algo_cli/small_context.py +206 -0
  216. algo_cli/spawn_budget.py +89 -0
  217. algo_cli/task_ledger.py +84 -0
  218. algo_cli/task_router.py +197 -0
  219. algo_cli/tool_context.py +94 -0
  220. algo_cli/tool_contract.py +99 -0
  221. algo_cli/tool_policy.py +357 -0
  222. algo_cli/tool_runtime.py +647 -0
  223. algo_cli/tools.py +3056 -0
  224. algo_cli/url_scheme.py +174 -0
  225. algo_cli/verify.py +154 -0
  226. algo_cli/version_manifest.py +178 -0
  227. algo_cli/vision_screenshot_verify.py +76 -0
  228. algo_cli/workspace_resolver.py +68 -0
  229. algo_cli/x_account.py +209 -0
  230. algo_cli/xai_auth.py +374 -0
  231. algo_cli/xai_client.py +600 -0
  232. algo_cli_runtime-0.14.0.dist-info/METADATA +369 -0
  233. algo_cli_runtime-0.14.0.dist-info/RECORD +237 -0
  234. algo_cli_runtime-0.14.0.dist-info/WHEEL +4 -0
  235. algo_cli_runtime-0.14.0.dist-info/entry_points.txt +3 -0
  236. algo_cli_runtime-0.14.0.dist-info/licenses/LICENSE +21 -0
  237. ollama_cli/__init__.py +67 -0
@@ -0,0 +1,60 @@
1
+ ---
2
+ title: Algo CLI Algorithm Evidence Contract
3
+ description: Durable distinction between catalog, kernel readiness, runtime use, and measured algorithm effectiveness.
4
+ status: active
5
+ updated: 2026-07-10
6
+ tags: [algo-cli, product-memory, algorithm-evidence, kernel-readiness, effectiveness]
7
+ ---
8
+
9
+ # Algo CLI Algorithm Evidence Contract
10
+
11
+ Algo CLI records ideas, contracts, runtime capabilities, and empirical evidence
12
+ at different layers. Those layers must not be collapsed into one “active” claim.
13
+
14
+ ## What each layer proves
15
+
16
+ | Layer | It proves | It does not prove |
17
+ |---|---|---|
18
+ | `ALGO.md` catalog | An algorithm or pattern has a reviewed contract and intended use. | That normal runtime traffic executes it. |
19
+ | Kernel manifest and `/kernel check` | Modules import, slash roots resolve, metadata is valid, and active action declarations have risk contracts. | Workload execution or benefit. |
20
+ | Action registry | A callable/command has coverage, risk, provider, and approval metadata. | Algorithmic correctness or effectiveness. |
21
+ | Tests and runtime evidence | The real boundary behaves as specified for measured inputs and fallbacks. | General benefit beyond the evaluated corpus. |
22
+
23
+ Use precise states: `planned`, `preview`, `contract-ready`, `observed`,
24
+ `effective`, `limited`, or `regressing`. Contract readiness is valuable, but it
25
+ must never be rendered as empirical effectiveness.
26
+
27
+ ## Evidence rule
28
+
29
+ An effectiveness claim requires all of the following:
30
+
31
+ 1. The actual production boundary is exercised, not a duplicate test-only
32
+ implementation.
33
+ 2. Deterministic positive, negative, and fallback cases pass.
34
+ 3. The result exposes enough provenance or telemetry to explain the decision.
35
+ 4. A pinned baseline or parity oracle is used when improvement is claimed.
36
+ 5. Missing prerequisites and runtime errors are reported as `unavailable`,
37
+ `error`, or `fail`; they never become a fabricated pass.
38
+
39
+ Critical safety bypasses are vetoes. Adding many trivial declarations cannot
40
+ average away one failed required check.
41
+
42
+ ## Bounded live evidence
43
+
44
+ The local algorithm-effectiveness probe uses the persisted canonical catalog
45
+ embedding as a deterministic query vector and makes no model or network call.
46
+ It exercises the production hybrid retrieval path twice and checks lexical
47
+ provenance and corpus-cache reuse, exact-vector and normalized-matrix reuse,
48
+ fusion mode against embedding coverage, stable top-k parity above its measured
49
+ crossover, bounded TinyLFU reuse, and value-aware embedding-tier arithmetic.
50
+ It also runs the production durable-memory admission path in an isolated
51
+ temporary state and requires one safe write, duplicate/secret rejection, and
52
+ metadata-only persistence. The probe passes only when every required check
53
+ passes.
54
+
55
+ Do not preserve transient benchmark numbers here. Measurements belong in probe
56
+ output or dated audits; this document preserves the evidence contract.
57
+
58
+ Authoritative implementation boundaries: `evals/algorithm_effectiveness.py`,
59
+ `kernels/manifest.py`, `action_registry.py`, `perf_telemetry.py`, and
60
+ `docs/ALGO.md`.
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: Algo CLI Execution and Verification Contract
3
+ description: Durable rules for runtime entrypoints, policy preflight, mutation ownership, evidence, and failure handling.
4
+ status: active
5
+ updated: 2026-07-10
6
+ tags: [algo-cli, product-memory, execution-verification, tool-policy, mutation-owner]
7
+ ---
8
+
9
+ # Algo CLI Execution and Verification Contract
10
+
11
+ This record describes the runtime invariants that must survive UI, model, and
12
+ pipeline changes. It explains ownership and evidence; procedural tool-selection
13
+ skills may provide narrower how-to guidance.
14
+
15
+ ## Execution surfaces
16
+
17
+ - Normal model-callable tools perform work and return structured results.
18
+ - `session_slash` owns deterministic working-directory navigation commands.
19
+ - `session_command` owns non-file session controls and registered slash routes.
20
+
21
+ Every model-invoked tool path must pass through the shared runtime preflight
22
+ before execution. The preflight resolves runtime arguments, capability tier,
23
+ policy-chain verdict, QoS metadata, and approval requirements. Unknown or
24
+ disallowed actions fail closed; a parallel path may not bypass the same gate
25
+ used by a serial path.
26
+
27
+ ## Mutation ownership
28
+
29
+ A multi-agent team has one write owner. Specialists receive bounded read-only
30
+ contexts and return evidence; the integration pipeline alone may edit the
31
+ workspace. Child work does not recursively delegate or create competing
32
+ writers. The integration owner remains subject to the same policy, approval,
33
+ required-change, and verification rules as an ordinary run.
34
+
35
+ ## Evidence for completed work
36
+
37
+ - Use file mutation tools for edits; use shell execution for tests, lint,
38
+ type-checking, builds, status, and diff evidence.
39
+ - A mutation is not complete merely because a tool returned text that sounds
40
+ successful. Verify the changed artifact and the smallest relevant behavior.
41
+ - Record Git status/diff evidence when a repository is available. If it is not,
42
+ preserve an explicit manual-verification warning instead of inventing proof.
43
+ - Keep `worked`, `failed`, `skipped`, and `denied` outcomes distinct in the
44
+ attempt ledger and telemetry.
45
+ - Do not cosmetically retry a recent identical failed signature; change the
46
+ hypothesis, input, or tool, or report the blocker.
47
+
48
+ ## Failure and fallback
49
+
50
+ Approval denial, unsafe input, unknown action, missing verification evidence,
51
+ and incompatible runtime state are explicit outcomes. Fallbacks must remain
52
+ bounded and observable; swallowed exceptions and silent policy downgrades are
53
+ not valid recovery.
54
+
55
+ Authoritative implementation boundaries: `tool_runtime.py`, `tool_policy.py`,
56
+ `agent_pipeline.py`, `agent_threads.py`, `runtime_services.py`, and
57
+ `session_commands.py`. Focused tests prove behavior; registry declarations only
58
+ describe the available contract.
59
+
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: Algo CLI Memory Lifecycle Contract
3
+ description: Durable placement, authority, capture, deduplication, retention, and readiness rules across Algo CLI memory systems.
4
+ status: active
5
+ updated: 2026-07-10
6
+ tags: [algo-cli, product-memory, memory-lifecycle, retrieval-authority, retention]
7
+ ---
8
+
9
+ # Algo CLI Memory Lifecycle Contract
10
+
11
+ This record defines where durable context belongs and how each memory layer is
12
+ allowed to influence work. It is a placement and lifecycle contract, not a
13
+ product-identity page or a current-state dashboard.
14
+
15
+ ## Placement matrix
16
+
17
+ | Information | Durable home | Rule |
18
+ |---|---|---|
19
+ | One stable fact or standing preference needed on most turns | `memory.json` through explicit `remember` or bounded completion capture | Keep it atomic and concise because it is always-on context. |
20
+ | A behavioral lesson the user explicitly asks to retain | `lessons-learned.md` through `append_lesson` | Capture the lesson, not a transcript. |
21
+ | A multi-paragraph product decision or invariant | Curated harness memory | State the contract, rationale, failure behavior, and authoritative modules. |
22
+ | A procedure, runbook, dated audit, or current snapshot | Curated wiki | Make its date and status explicit; archive it when superseded. |
23
+ | Entity relationships and ranked associations | index-compute-lab | Use for navigation and discovery, not as proof of a live fact. |
24
+ | Optional associative/session recall | Intuition or Echo Veil | Treat as a hint layer; it is never canonical by itself. |
25
+
26
+ Do not copy the same prose across tiers. Promote a small atomic fact to
27
+ always-on memory only when its value justifies prompt cost; keep supporting
28
+ detail in one RAG document.
29
+
30
+ ## Authority and retrieval
31
+
32
+ User instructions and verified live files, endpoints, and tool results outrank
33
+ all persisted memory. Lessons, harness records, graph results, and optional
34
+ recall blocks are navigation evidence. Consequential claims must be checked at
35
+ the live source before action.
36
+
37
+ Retrieval must retain source identity and rank provenance. Incomplete vector
38
+ coverage is an availability condition, not a relevance signal: newly added
39
+ records must remain discoverable through lexical evidence while embeddings
40
+ catch up.
41
+
42
+ ## Capture, cleanup, and retention
43
+
44
+ - Automatic capture runs only after a normally completed chat or runtime-agent
45
+ turn and examines only the original user text. It requires an explicit durable
46
+ marker, rejects quoted/code/transient/task/secret/PII input, normalizes before
47
+ exact/Jaccard deduplication, and writes at most one entry per turn.
48
+ - Daily writes, fingerprint metadata, and total memory characters are capped.
49
+ Rejected text is never persisted; the sidecar contains timestamps and hashes,
50
+ not memory bodies. `/memory-auto status|on|off` exposes the persisted opt-out.
51
+ - Explicit `remember` and `append_lesson` requests suppress automatic capture in
52
+ that turn so the same statement is not written twice.
53
+ - Batch reconciliation must hold the memory lock, write atomically, and retain a
54
+ pre-change backup.
55
+ - Prefer consolidation and explicit historical status over silent deletion.
56
+ - Do not enable destructive time-based decay until records carry trustworthy
57
+ timestamps and use/access evidence.
58
+ - A dated implementation observation belongs in a wiki or audit, not in this
59
+ durable contract.
60
+
61
+ ## Readiness vocabulary
62
+
63
+ Memory readiness is multi-dimensional. `installed`, `enabled`, `write_wired`,
64
+ `retrieval_wired`, and `persistence_wired` are separate claims. A package or
65
+ feature flag alone must never be presented as a functioning write/recall path.
66
+ The score accepts disabled Echo Veil; if enabled, installation and all three
67
+ wiring stages must be proven or the critical memory gate fails.
68
+
69
+ Authoritative implementation boundaries: `config.py`, `memory_candidates.py`,
70
+ `memory_runtime.py`, `context_budget.py`, `harness.py`, and
71
+ `memory_echo_veil.py`. When this document and live behavior disagree, verify
72
+ the code and update this contract.
@@ -0,0 +1,41 @@
1
+ # Structured Codex plugin metadata indexing
2
+
3
+ **Status:** Completed and verified.
4
+
5
+ ## Current State
6
+
7
+ When the user explicitly enables external harness sources, Algo CLI indexes Codex plugin metadata without treating it as undifferentiated extension noise:
8
+
9
+ - `codex:extension` for `SKILL.md` files
10
+ - `codex:plugin` for `.codex-plugin/plugin.json` manifests
11
+ - `codex:install` for `.codex-remote-plugin-install.json` install receipts
12
+ - `codex:connector` for `.app.json` connector metadata
13
+ - `codex:mcp` for `.mcp.json` server declarations
14
+ - `codex:command` for plugin command markdown
15
+ - `codex:agent` for plugin agent profiles
16
+
17
+ JSON metadata is normalized into useful titles, descriptions, and tags. For example, Google Drive connector records surface as `Codex app connectors: google-drive` instead of raw `.app` filenames, and remote install receipts surface as `Codex plugin install: google-drive`.
18
+
19
+ ## Why This Matters
20
+
21
+ The original audit found that extension records could dominate the harness index and dilute semantic retrieval. The current implementation keeps the useful plugin capability information while avoiding raw, low-context metadata records.
22
+
23
+ The live harness quality report distinguishes generic extension records from structured plugin metadata, so a larger Codex plugin cache no longer makes the harness look unhealthy by itself.
24
+
25
+ ## Verification
26
+
27
+ Relevant tests:
28
+
29
+ - `tests/test_harness.py::test_iter_files_supports_nested_plugin_cache_globs`
30
+ - `tests/test_harness.py::test_codex_plugin_metadata_sources_are_builtin_harness_sources`
31
+ - `tests/test_harness.py::test_codex_plugin_manifest_record_uses_json_metadata`
32
+ - `tests/test_harness.py::test_codex_remote_plugin_install_record_uses_json_metadata`
33
+ - `tests/test_harness.py::test_codex_connector_and_mcp_records_use_json_metadata`
34
+ - `tests/test_harness.py::test_quality_allows_low_project_share_when_structured_plugin_metadata_is_indexed`
35
+
36
+ Operational checks:
37
+
38
+ - Run `/harness status` to inspect counts and quality.
39
+ - Run `/harness score` to grade readiness against the current Algo CLI review gates.
40
+ - Run `/harness refresh` after plugin/source changes.
41
+ - Run `/harness embed` if pending embeddings appear.
@@ -0,0 +1,32 @@
1
+ # index-compute-lab ↔ Algo CLI integration
2
+
3
+ **Lab path (default):** `~/index-compute-lab`; override it with `ALGO_CLI_INDEX_COMPUTE_LAB_ROOT`.
4
+
5
+ ## Seamless context (every model / provider)
6
+
7
+ 1. **Auto-inject (opt-in, default OFF)** — After `/icl on`, Algo CLI runs `query.py ask` and prepends a `## Knowledge Graph (index-compute-lab)` block to the turn. This content becomes part of the provider request, including when a cloud model is selected.
8
+
9
+ 2. **Harness index** — `atoms/*.md` reports and notes are indexed dynamically under harness `index-compute-lab` (via `atoms_dir()` in `all_source_roots()`) and participate in vector RAG (`/harness refresh`). Do **not** also list the lab in `~/.algo_cli/harness_roots.json`; that path is for user extras only and previously double-indexed agent notes.
10
+
11
+ 3. **Tool** — `query_knowledge_graph` for explicit follow-up questions.
12
+
13
+ ## Configuration
14
+
15
+ | Setting | Default |
16
+ |---------|---------|
17
+ | `Config.index_compute_lab_auto_inject` | `false` |
18
+ | `ALGO_CLI_INDEX_COMPUTE_LAB_ROOT` | overrides path |
19
+ | `INDEX_COMPUTE_LAB_ROOT` | legacy env alias |
20
+
21
+ ## Commands
22
+
23
+ - `/icl` — status (root, assets ready, auto-inject on/off)
24
+ - `/icl on` / `/icl off` — toggle auto-inject
25
+ - `/icl ask <question>` — one-off graph query
26
+ - `/icl path` — show resolved root
27
+
28
+ ## First run
29
+
30
+ If a legacy `index-compute-lab` entry is present in `~/.algo_cli/harness_roots.json`, startup removes it (lab indexing is dynamic). Run `/harness refresh` once to drop any duplicate atom records, then `/harness embed` for vectors.
31
+
32
+ **Last updated:** 2026-07
@@ -0,0 +1,55 @@
1
+ # Inference Harness Loop Blueprint
2
+
3
+ Date: 2026-06-12
4
+
5
+ This note captures how EOSD, ALK-delta, AVEE, and CPDI should be wired into the Algo CLI agent loop.
6
+
7
+ ## Architecture
8
+
9
+ These algorithms live below the normal hosted-API harness line.
10
+
11
+ - Algo CLI agent loop: orchestration, Agent Blocks, policy, routing metadata, telemetry display, and fallback decisions.
12
+ - Inference gateway: one OpenAI/Anthropic-compatible facade that accepts agent requests, chooses hosted or local routes, and returns normalized provenance.
13
+ - Local inference engine: vLLM/SGLang fork or adapter where decode, KV, forward-pass, and scheduler changes are implemented.
14
+
15
+ The agent loop should not pretend it can implement EOSD, ALK-delta, AVEE, or CPDI through an ordinary hosted model call. It should guide implementation plans toward the local engine and expose only stable policy knobs upward.
16
+
17
+ ## Algorithm Placement
18
+
19
+ EOSD belongs in the speculative decoding loop. Before each draft round, compute prefix-visible draft entropy, map it through a calibrated `beta_hat = g(H)`, choose the speculative depth `k`, and record realized `k`, acceptance rate, and tokens/sec. EOSD remains lossless when `k` is chosen before drafting from prefix information.
20
+
21
+ ALK-delta belongs in the KV cache manager or PagedAttention layer. The engine stores anchors, low-rank factors, and sparse residuals, then exposes a per-request certified attention-output perturbation bound. The harness consumes that scalar for policy and fallback.
22
+
23
+ AVEE belongs in the model forward pass. It requires calibrated auxiliary exit heads and an e-process accumulator. The harness supplies `risk_delta`, while the engine returns exit-layer telemetry and measured agreement.
24
+
25
+ CPDI belongs in the serving scheduler. The harness supplies `priority_weight`; the scheduler allocates prefill/decode work using normalized remaining work and returns queue and latency telemetry.
26
+
27
+ ## Gateway Contract
28
+
29
+ Request metadata should stay small:
30
+
31
+ - `model`
32
+ - `messages`
33
+ - `risk_delta`
34
+ - `priority_weight`
35
+ - `lossless_required`
36
+
37
+ Response provenance should include:
38
+
39
+ - engine route and fallback reason
40
+ - realized speedup
41
+ - EOSD acceptance stats
42
+ - ALK-delta KV certificate
43
+ - AVEE exit histogram
44
+ - CPDI queue and latency metrics
45
+
46
+ ## Build Order
47
+
48
+ 1. Stand up a vanilla local-engine route behind the gateway and verify routing, telemetry, and hosted fallback.
49
+ 2. Add EOSD first because deterministic exact-output regression tests can check the losslessness contract.
50
+ 3. Add CPDI scheduler experiments next because they are mostly scheduler logic.
51
+ 4. Add ALK-delta and AVEE last because they require cache/kernel work, calibration, and stricter quality validation.
52
+
53
+ ## Agent Loop Integration
54
+
55
+ `algo_cli.inference_harness` detects inference-engine tasks and injects this contract into each Agent Block system prompt. Normal agent tasks are unaffected.
@@ -0,0 +1,35 @@
1
+ # main.py decomposition map
2
+
3
+ `algo_cli/main.py` is the CLI orchestrator. Split it incrementally; keep `from algo_cli import main` working for tests and scripts.
4
+
5
+ ## Done
6
+
7
+ | Module | Responsibility |
8
+ |--------|----------------|
9
+ | `chat_protocol.py` | `get_attr`, `normalize_tool_call`, `serialize_tool_call`, `collapse_tool_history_for_gemini`, `normalize_message` |
10
+ | `model_routing.py` | Cloud/local/xAI host routing and model name classifiers |
11
+ | `runtime_services.py` | `create_client`, `client_for_model`, Ollama serve, harness-gateway lifecycle, `apply_tool_runtime_env`, readiness caches |
12
+ | `context_budget.py` | Token estimates, `build_system_prompt`, pruning, compaction, `context_status`, `unpack_embed` cache keys, `estimate_usage_with_system_prompt` |
13
+ | `perf_telemetry.py` | Perf JSONL buffer, chat/tool/compaction metrics, embed perf log, `/perf` summary |
14
+ | `tool_runtime.py` | `run_tool`, approval, attempt ledger, reflex augmentation, reflection checkpoint, pipeline tool execution |
15
+ | `agent_pipeline.py` | `run_agent_block`, `run_agent_pipeline`, required-change contract, recovery/replan, session pipeline buffer |
16
+ | `slash_dispatch.py` | `SLASH_COMMANDS`, `SlashCommandCompleter`, `handle_command` (delegates to `main` for handlers) |
17
+ | `session_commands.py` | Model-invokable `/read`, `/ls`, `/cd`, `/cwd` |
18
+ | `oneshot.py` | `--oneshot --json` NDJSON mode |
19
+ | `agent_blocks.py` | Pipeline definitions and TOML loading |
20
+
21
+ `main.py` re-exports moved symbols so `tests/test_main_helpers.py` and `test_verify.py` need no churn.
22
+
23
+ ## Next slices (recommended order)
24
+
25
+ 1. **Handler extraction** — move `handle_*_command` and auth helpers out of `main.py` so `slash_dispatch` does not lazy-import `main` (optional cleanup).
26
+
27
+ ## Keep in `main.py`
28
+
29
+ - `main()` REPL loop, `parse_args`, migration/onboarding hooks
30
+ - `agent_loop` until `tool_runtime` exists (then thin wrapper only)
31
+
32
+ ## Tests
33
+
34
+ - Prefer unit tests on new modules (`test_chat_protocol.py`, `test_model_routing.py`) over growing `test_main_helpers.py`.
35
+ - After each slice: `ruff check algo_cli tests` and `pytest -q`.
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: Privacy and local context
3
+ description: How Algo CLI discovers, stores, and sends local context.
4
+ status: active
5
+ tags: [privacy, harness, cloud, context, consent]
6
+ ---
7
+
8
+ # Privacy and local context
9
+
10
+ Algo CLI starts with repository-provided documentation, skills, and files that the user creates under `~/.algo_cli`. It does not index other agent stores by default.
11
+
12
+ ## Always-sent model context
13
+
14
+ Every normal chat request sends the active conversation and the assembled Algo CLI system context to the selected inference provider. The assembled context includes `SOUL.md`, `IDENTITY.md`, `USER.md`, saved memories, and relevant retrieved lessons when available. If the active model uses a cloud provider, this content may leave the machine.
15
+
16
+ Automatic memory capture is enabled by default. Its bounded completion gate may save an explicit, high-confidence durable statement after a successful turn. `/memory-auto off` stops future automatic captures; it does not remove existing entries. Inspect existing entries with `/memories` and remove one with `/forget ID`.
17
+
18
+ ## Optional sources
19
+
20
+ - `/harness external on` enables discovery of supported local agent stores such as Codex, Claude, OpenClaw, Mercury, and shared agent skills.
21
+ - `/icl on` enables index-compute-lab retrieval and automatic graph context.
22
+ - `/code-rag on` enables working-directory source indexing and relevant-snippet retrieval.
23
+ - `/skills on` enables bounded run-summary capture and automatic local skill-candidate crystallization.
24
+ - Entries in `~/.algo_cli/harness_roots.json` are treated as explicit user-provided roots.
25
+
26
+ Disable an optional source with `/harness external off`, `/icl off`, or `/code-rag off`. Changing either harness setting rebuilds the generated harness index so disabled records are removed. `/code-rag off` also purges every persisted code-index file.
27
+
28
+ ## Working-directory code retrieval boundary
29
+
30
+ - **Command boundary:** `/code-rag status` is read-only. `/code-rag on` records the current explicit consent version; a legacy saved `code_rag_enabled: true` value does not count as consent. Model-invoked `on` and `off` commands require approval.
31
+ - **Index boundary:** when enabled, Algo CLI scans supported source files beneath the active cwd, skips hidden/build/vendor directories and secret-like filenames, rejects symlinks that escape the cwd, and stores chunks plus local embeddings in `~/.algo_cli/code_index/`. `/code-rag off` deletes those generated index files, not the source files.
32
+ - **Provider boundary:** embeddings are generated through local Ollama. Retrieved source snippets are then added to the active chat request, so they may leave the machine when the selected inference provider is remote.
33
+
34
+ ## Skill run history
35
+
36
+ Skill run-history capture and automatic crystallization are off by default. `/skills on` opts in to bounded completed-run summaries at `~/.algo_cli/private/run_history.jsonl`. After the configured interval, a genuinely local, non-embedding Ollama model may turn qualifying patterns into quarantined skill candidates for explicit review. Crystallization skips when no such local model is available and never falls back to a cloud provider. `/skills off` stops future capture and automatic crystallization but does not delete prior history. Older installs may also have a legacy read-only input at `~/.algo_cli/run_history.jsonl`.
37
+
38
+ ## Provider boundary
39
+
40
+ Retrieved context becomes part of the model request. If the selected model uses a cloud provider, enabled local context may leave the machine. Enable external sources only when their content is appropriate for the selected provider.
41
+
42
+ Algo CLI removes common credential forms and indexes connector/MCP JSON as metadata only. Redaction is a defense-in-depth measure, not a guarantee that arbitrary sensitive prose will be detected.
43
+
44
+ ## Local state
45
+
46
+ Runtime configuration, generated indexes, memories, identity files, and credentials live under `~/.algo_cli` unless `ALGO_CLI_CONFIG_DIR` overrides the location. These files are not part of the source distribution. Keep the directory private and exclude it from repositories and backups that are shared publicly.
47
+
48
+ Automatic memory capture is bounded and privacy-gated. Inspect or disable it with `/memory-auto status` and `/memory-auto off`.