brainlayer 1.6.6__tar.gz → 1.6.7__tar.gz

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 (286) hide show
  1. {brainlayer-1.6.6 → brainlayer-1.6.7}/PKG-INFO +1 -1
  2. {brainlayer-1.6.6 → brainlayer-1.6.7}/pyproject.toml +1 -1
  3. {brainlayer-1.6.6 → brainlayer-1.6.7}/server.json +2 -2
  4. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/__init__.py +1 -1
  5. brainlayer-1.6.7/src/brainlayer/_build.py +1 -0
  6. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/agent_provenance.py +4 -1
  7. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/t3_provenance.py +57 -1
  8. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/watcher.py +140 -8
  9. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/watcher_bridge.py +42 -5
  10. brainlayer-1.6.6/src/brainlayer/_build.py +0 -1
  11. {brainlayer-1.6.6 → brainlayer-1.6.7}/.gitignore +0 -0
  12. {brainlayer-1.6.6 → brainlayer-1.6.7}/LICENSE +0 -0
  13. {brainlayer-1.6.6 → brainlayer-1.6.7}/README.md +0 -0
  14. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/brainlayer-version-check.sh +0 -0
  15. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/hotlane_brainbar_daemon.py +0 -0
  16. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/backup-daily.sh +0 -0
  17. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/brainlayer-env-run.sh +0 -0
  18. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/brainlayer.env.example +0 -0
  19. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.backup-daily.plist +0 -0
  20. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.daemon.plist +0 -0
  21. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.decay.plist +0 -0
  22. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.drain.plist +0 -0
  23. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.health-check.plist +0 -0
  24. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.hotlane-brainbar.plist +0 -0
  25. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.index.plist +0 -0
  26. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.jsonl-backup.plist +0 -0
  27. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.log-cap.plist +0 -0
  28. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.maintenance-nightly.plist +0 -0
  29. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.maintenance-weekly.plist +0 -0
  30. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.maintenance.plist +0 -0
  31. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.observability.plist +0 -0
  32. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.p0-counter.plist +0 -0
  33. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.repair-fts.plist +0 -0
  34. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.t3-ingest.plist +0 -0
  35. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.throughput-watchdog.plist +0 -0
  36. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.tier0-watchdog.plist +0 -0
  37. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.wal-checkpoint.plist +0 -0
  38. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.brainlayer.watch.plist +0 -0
  39. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/com.etanhey.brainlayer-fleet-watchdog.plist +0 -0
  40. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/fleet-watchdog.sh +0 -0
  41. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/install.sh +0 -0
  42. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/jsonl-backup.sh +0 -0
  43. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/launchd/throughput-watchdog.py +0 -0
  44. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/release-verify-signatures.sh +0 -0
  45. {brainlayer-1.6.6 → brainlayer-1.6.7}/scripts/tier0-watchdog.sh +0 -0
  46. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/__main__.py +0 -0
  47. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/_helpers.py +0 -0
  48. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/agent_census.py +0 -0
  49. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/agent_profiles.py +0 -0
  50. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/agy_attribution.py +0 -0
  51. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/alarm.py +0 -0
  52. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/archive_collapse.py +0 -0
  53. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/archive_lifecycle.py +0 -0
  54. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/backup_daily.py +0 -0
  55. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/backup_retention_invariant.py +0 -0
  56. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/badge_state.py +0 -0
  57. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/bitemporal.py +0 -0
  58. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/brainbar_activation.py +0 -0
  59. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/brainbar_auto_activation.py +0 -0
  60. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/brainbar_hybrid_helper.py +0 -0
  61. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/brainbar_identity.py +0 -0
  62. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/cachedelete_purge.swift +0 -0
  63. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/calibrate.py +0 -0
  64. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/chunk_origin.py +0 -0
  65. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/chunk_origin_backfill.py +0 -0
  66. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/chunk_origin_wipe.py +0 -0
  67. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/chunk_write.py +0 -0
  68. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/classify.py +0 -0
  69. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/claude_paths.py +0 -0
  70. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/cli/__init__.py +0 -0
  71. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/cli/wizard.py +0 -0
  72. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/cli_jobs.py +0 -0
  73. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/cli_new.py +0 -0
  74. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/cloud_backfill.py +0 -0
  75. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/clustering.py +0 -0
  76. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/codex_zst.py +0 -0
  77. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/component_jobs.py +0 -0
  78. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/config.py +0 -0
  79. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/consolidation_plan.py +0 -0
  80. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/content_class.py +0 -0
  81. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/content_hash_repair.py +0 -0
  82. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/correction_judge.py +0 -0
  83. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/data/agents_registry.yaml +0 -0
  84. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/data/sandbox_seeds/skill-eval-baseline.json +0 -0
  85. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/db_shrink.py +0 -0
  86. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/decay.py +0 -0
  87. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/decay_backfill.py +0 -0
  88. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/decay_job.py +0 -0
  89. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/dedupe.py +0 -0
  90. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/dedupe_merge.py +0 -0
  91. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/deploy_drift.py +0 -0
  92. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/disk_space.py +0 -0
  93. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/doctor.py +0 -0
  94. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/drain.py +0 -0
  95. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/drain_liveness.py +0 -0
  96. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/drive_credentials.py +0 -0
  97. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/embeddings.py +0 -0
  98. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/engine.py +0 -0
  99. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/enrichment_replay.py +0 -0
  100. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/__init__.py +0 -0
  101. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/abcde_enrich_runner.py +0 -0
  102. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/abcde_variants.py +0 -0
  103. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/abcde_variants.yaml +0 -0
  104. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/benchmark.py +0 -0
  105. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/enrichment_gold.py +0 -0
  106. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/enrichment_graders.py +0 -0
  107. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/enrichment_judge.py +0 -0
  108. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/enrichment_llm_judge.py +0 -0
  109. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/enrichment_quality_benchmark.py +0 -0
  110. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/experiment_store.py +0 -0
  111. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/fixtures/README.md +0 -0
  112. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/labeling/enrichment-labeler.html +0 -0
  113. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/phoenix_gate/__init__.py +0 -0
  114. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/phoenix_gate/__main__.py +0 -0
  115. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/phoenix_gate/baseline_store.py +0 -0
  116. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/phoenix_gate/cli.py +0 -0
  117. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/phoenix_gate/models.py +0 -0
  118. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/phoenix_gate/phoenix_client.py +0 -0
  119. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/phoenix_gate/regression_gate.py +0 -0
  120. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/phoenix_gate/triggers.py +0 -0
  121. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/eval/pilot_artifact_report.py +0 -0
  122. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/fallback_replay.py +0 -0
  123. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/git_learning.py +0 -0
  124. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/health_check.py +0 -0
  125. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/health_facts.py +0 -0
  126. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/health_verdict.py +0 -0
  127. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/hook_python.py +0 -0
  128. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/hooks/__init__.py +0 -0
  129. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/hooks/indexer.py +0 -0
  130. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/hotlane_budget.py +0 -0
  131. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/import_sweep.py +0 -0
  132. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/index_admission.py +0 -0
  133. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/index_budget.py +0 -0
  134. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/index_completeness.py +0 -0
  135. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/index_new.py +0 -0
  136. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/index_watchdog.py +0 -0
  137. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/ingest/__init__.py +0 -0
  138. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/ingest/codex.py +0 -0
  139. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/ingest/codex_manifest.py +0 -0
  140. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/ingest/t3.py +0 -0
  141. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/ingest/t3_bookmark.py +0 -0
  142. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/ingest_denylist.py +0 -0
  143. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/ingest_guard.py +0 -0
  144. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/isolation_proof.py +0 -0
  145. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/job_alerts.py +0 -0
  146. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/job_lifecycle_health.py +0 -0
  147. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/jobs.py +0 -0
  148. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/jsonl_backup.py +0 -0
  149. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/kg/__init__.py +0 -0
  150. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/kg_cleanup.py +0 -0
  151. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/kg_judge.py +0 -0
  152. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/kg_promotion.py +0 -0
  153. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/kg_repo.py +0 -0
  154. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/kg_review_session.py +0 -0
  155. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/kg_session_finish.py +0 -0
  156. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/kg_session_harvest.py +0 -0
  157. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/launchd_consolidation.py +0 -0
  158. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/launchd_install.py +0 -0
  159. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/launchd_primitive.py +0 -0
  160. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/launchd_revert.py +0 -0
  161. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/launcher_policy_reconcile.py +0 -0
  162. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/lexical_defense.py +0 -0
  163. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/lexical_defense_dictionary.json +0 -0
  164. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/linkedin_import.py +0 -0
  165. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/log_cap.py +0 -0
  166. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/maintenance.py +0 -0
  167. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/maintenance_calendar.py +0 -0
  168. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/maintenance_control.py +0 -0
  169. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/maintenance_upload_recovery.py +0 -0
  170. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/__init__.py +0 -0
  171. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/_format.py +0 -0
  172. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/_shared.py +0 -0
  173. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/enrich_handler.py +0 -0
  174. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/entity_handler.py +0 -0
  175. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/palette.py +0 -0
  176. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/search_handler.py +0 -0
  177. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/store_handler.py +0 -0
  178. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp/tags_handler.py +0 -0
  179. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp_socket_config.py +0 -0
  180. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/mcp_stdio_bridge.py +0 -0
  181. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/memory_types.py +0 -0
  182. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/migrate.py +0 -0
  183. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/migration_custody.py +0 -0
  184. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/migration_journal.py +0 -0
  185. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/migration_runtime.py +0 -0
  186. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/notification_policy.py +0 -0
  187. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/observability_backup.py +0 -0
  188. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/observability_indexes.py +0 -0
  189. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/observability_surface.py +0 -0
  190. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/observability_transport.py +0 -0
  191. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/p0_longitudinal_count.py +0 -0
  192. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/parent_death.py +0 -0
  193. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/paths.py +0 -0
  194. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pause.py +0 -0
  195. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/phonetic.py +0 -0
  196. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/__init__.py +0 -0
  197. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/agent_enrichment.py +0 -0
  198. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/analyze_communication.py +0 -0
  199. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/batch_extraction.py +0 -0
  200. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/brain_graph.py +0 -0
  201. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/chat_tags.py +0 -0
  202. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/chunk.py +0 -0
  203. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/classify.py +0 -0
  204. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/cloud_scrub.py +0 -0
  205. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/cluster_sampling.py +0 -0
  206. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/code_intelligence.py +0 -0
  207. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/correction_detection.py +0 -0
  208. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/correction_mining.py +0 -0
  209. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/digest.py +0 -0
  210. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/enrichment_prompts.py +0 -0
  211. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/enrichment_results.py +0 -0
  212. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/enrichment_tiers.py +0 -0
  213. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/entity_extraction.py +0 -0
  214. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/entity_resolution.py +0 -0
  215. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/extract.py +0 -0
  216. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/extract_claude_desktop.py +0 -0
  217. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/extract_corrections.py +0 -0
  218. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/extract_markdown.py +0 -0
  219. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/extract_whatsapp.py +0 -0
  220. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/frustration_mining.py +0 -0
  221. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/git_overlay.py +0 -0
  222. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/kg_extraction.py +0 -0
  223. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/kg_extraction_groq.py +0 -0
  224. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/longitudinal_analyzer.py +0 -0
  225. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/obsidian_export.py +0 -0
  226. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/operation_grouping.py +0 -0
  227. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/plan_linking.py +0 -0
  228. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/rate_limiter.py +0 -0
  229. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/relation_backfill.py +0 -0
  230. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/relation_verification.py +0 -0
  231. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/sanitize.py +0 -0
  232. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/secret_scrub.py +0 -0
  233. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/semantic_style.py +0 -0
  234. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/sentiment.py +0 -0
  235. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/session_history.py +0 -0
  236. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/style_embed.py +0 -0
  237. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/style_index.py +0 -0
  238. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/tag_entity_promotion.py +0 -0
  239. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/temporal_chains.py +0 -0
  240. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/time_batcher.py +0 -0
  241. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/unified_timeline.py +0 -0
  242. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/pipeline/write_queue.py +0 -0
  243. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/policy_reconcile.py +0 -0
  244. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/provenance.py +0 -0
  245. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/provenance_autosupersede.py +0 -0
  246. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/provenance_integration.py +0 -0
  247. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/queue_io.py +0 -0
  248. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/queue_merge.py +0 -0
  249. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/readonly_snapshot.py +0 -0
  250. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/reembed_backfill.py +0 -0
  251. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/retired_services.py +0 -0
  252. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/runtime_store.py +0 -0
  253. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/sandbox_db.py +0 -0
  254. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/schema_ddl_ledger.py +0 -0
  255. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/scoping.py +0 -0
  256. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/scrub_at_rest.py +0 -0
  257. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/search_fanout.py +0 -0
  258. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/search_profile.py +0 -0
  259. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/search_repo.py +0 -0
  260. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/search_response.py +0 -0
  261. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/service_supervisor.py +0 -0
  262. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/session_repo.py +0 -0
  263. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/setup.py +0 -0
  264. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/socket_hygiene.py +0 -0
  265. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/source_class_migration.py +0 -0
  266. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/spotlight.py +0 -0
  267. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/storage.py +0 -0
  268. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/store.py +0 -0
  269. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/supervisor_adapters.py +0 -0
  270. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/supervisor_child.py +0 -0
  271. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/supervisor_diagnostics.py +0 -0
  272. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/supervisor_guard.py +0 -0
  273. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/supervisor_jobs.py +0 -0
  274. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/system_prompt_guard.py +0 -0
  275. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/t3_linkage_alarm.py +0 -0
  276. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/t3_sources.py +0 -0
  277. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/tag_normalization.py +0 -0
  278. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/taxonomy.json +0 -0
  279. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/telemetry.py +0 -0
  280. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/timestamp_iso.py +0 -0
  281. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/types.py +0 -0
  282. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/vector_store.py +0 -0
  283. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/wal_checkpoint.py +0 -0
  284. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/writer_policy.py +0 -0
  285. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/writer_telemetry.py +0 -0
  286. {brainlayer-1.6.6 → brainlayer-1.6.7}/src/brainlayer/zstd_stream.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: brainlayer
3
- Version: 1.6.6
3
+ Version: 1.6.7
4
4
  Summary: Persistent local memory for AI agents — 16 BrainBar MCP tools, semantic search, knowledge graph, SQLite
5
5
  Project-URL: Homepage, https://brainlayer.etanheyman.com
6
6
  Project-URL: Repository, https://github.com/EtanHey/brainlayer
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "brainlayer"
3
- version = "1.6.6"
3
+ version = "1.6.7"
4
4
  description = "Persistent local memory for AI agents — 16 BrainBar MCP tools, semantic search, knowledge graph, SQLite"
5
5
  license = {text = "Apache-2.0"}
6
6
  readme = "README.md"
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.etanhey/brainlayer",
4
4
  "title": "BrainLayer",
5
5
  "description": "Persistent local memory for AI agents \u2014 semantic search, knowledge graph, and 16 BrainBar MCP tools with ToolAnnotations over SQLite.",
6
- "version": "1.6.6",
6
+ "version": "1.6.7",
7
7
  "websiteUrl": "https://brainlayer.etanheyman.com",
8
8
  "repository": {
9
9
  "url": "https://github.com/EtanHey/brainlayer",
@@ -14,7 +14,7 @@
14
14
  "registryType": "pypi",
15
15
  "registryBaseUrl": "https://pypi.org",
16
16
  "identifier": "brainlayer",
17
- "version": "1.6.6",
17
+ "version": "1.6.7",
18
18
  "runtimeHint": "pipx",
19
19
  "transport": {
20
20
  "type": "stdio"
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- __version__ = "1.6.6"
5
+ __version__ = "1.6.7"
6
6
  # Git sha the distributed package was built from; stamped by the release build, None in a source tree.
7
7
  # scripts/sprint_gate.py reads it in "keg" mode to prove the served package is the code under test.
8
8
  # No runtime `str | None` annotation: launchd/install.sh imports this under /usr/bin/python3 (3.9).
@@ -0,0 +1 @@
1
+ BUILD_SHA = "983d28262294c217eb1c4ca0e2c8cb17b728d313"
@@ -17,7 +17,7 @@ from typing import Literal, cast
17
17
  from .agy_attribution import agy_conversation, read_conversation_agent
18
18
  from .content_class import normalize_content_class
19
19
  from .ingest_denylist import MEMORY_READER_ATTRIBUTIONS, is_denylisted, memory_reader_attribution
20
- from .t3_provenance import T3_APP_SESSION, CompactCodexHeader, is_t3_app_initiated_codex_session
20
+ from .t3_provenance import T3_APP_SESSION, T3_UNLINKED, CompactCodexHeader, is_t3_app_initiated_codex_session
21
21
 
22
22
  SearchPolicy = Literal["KEEP", "ISOLATE", "OUT"]
23
23
  EffectiveVisibility = Literal["default", "operational", "cold"]
@@ -33,6 +33,7 @@ ProvenanceClass = Literal[
33
33
  "recon-agent",
34
34
  "t3-app-session",
35
35
  "t3-thread",
36
+ "t3-unlinked",
36
37
  "unknown",
37
38
  "workflow-agent",
38
39
  ]
@@ -47,6 +48,7 @@ PROVENANCE_CLASSES = frozenset(
47
48
  "recon-agent",
48
49
  T3_APP_SESSION,
49
50
  "t3-thread",
51
+ T3_UNLINKED,
50
52
  "unknown",
51
53
  "workflow-agent",
52
54
  }
@@ -265,6 +267,7 @@ def derive_source_class(
265
267
  provenance_map: dict[str, SourceClass] = {
266
268
  T3_APP_SESSION: "cli-agent",
267
269
  "t3-thread": "cli-agent",
270
+ T3_UNLINKED: "cli-agent",
268
271
  "recon-agent": "brain-worker",
269
272
  "fleet-subagent": "fleet-coordination",
270
273
  "product-subagent": "subagent",
@@ -3,19 +3,32 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import json
6
+ import math
6
7
  import os
7
8
  import re
8
9
  import sqlite3
10
+ import time
9
11
  from dataclasses import dataclass
10
12
  from pathlib import Path
11
13
  from typing import NoReturn
12
14
 
13
15
  from . import t3_linkage_alarm
14
- from .alarm import build_alarm, raise_alarm
16
+ from .alarm import BrainLayerAlarm, build_alarm, raise_alarm
15
17
  from .t3_sources import DEFAULT_T3_STATE_DB as DEFAULT_T3_STATE_DB
16
18
  from .t3_sources import resolve_t3_sources
17
19
 
18
20
  T3_APP_SESSION = "t3-app-session"
21
+ # A T3-origin Codex session T3 never linked within the hold window: indexed, labelled, no thread link.
22
+ T3_UNLINKED = "t3-unlinked"
23
+ # How long a T3-origin Codex session is held for T3 to link it, counted from the session's own start.
24
+ # Evidence (2026-11-19): on the M4, 0 of 87 sessions that ever raised t3_runtime_linkage_pending
25
+ # (16 Oct - 19 Nov) were linked later, and no linked session ever raised it, so T3 links before
26
+ # the watcher's first read (one 30 s poll); on the M1, 0 of 8 in 7 days. 24 h is far above that.
27
+ DEFAULT_T3_LINKAGE_HOLD_S = 24 * 3600.0
28
+ T3_LINKAGE_HOLD_ENV = "BRAINLAYER_T3_LINKAGE_HOLD_S"
29
+ # Set by the flush callback on an entry it defers this flush while its session waits for T3 linkage:
30
+ # the hold's start (epoch seconds). The watcher reads it to report held_for_linkage instead of lag.
31
+ T3_LINKAGE_HOLD_KEY = "_t3_linkage_hold_started_at"
19
32
  _CODEX_SESSION_ID_RE = re.compile(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", re.IGNORECASE)
20
33
  _REQUIRED_RUNTIME_COLUMNS = frozenset({"thread_id", "provider_name", "resume_cursor_json"})
21
34
  _V2_TABLE = "orchestration_v2_projection_provider_threads"
@@ -124,6 +137,49 @@ def codex_header_identity(
124
137
  )
125
138
 
126
139
 
140
+ def t3_linkage_hold_window_s() -> float:
141
+ """The hold window in seconds; a missing, non-finite or negative value is the default."""
142
+ raw = os.environ.get(T3_LINKAGE_HOLD_ENV)
143
+ try:
144
+ value = float(raw) if raw is not None else DEFAULT_T3_LINKAGE_HOLD_S
145
+ except ValueError:
146
+ value = math.nan
147
+ return value if math.isfinite(value) and value >= 0 else DEFAULT_T3_LINKAGE_HOLD_S
148
+
149
+
150
+ def codex_session_started_at(session_id: str) -> float | None:
151
+ """Epoch seconds embedded in a UUIDv7 Codex session id; None for any other UUID version."""
152
+ digits = session_id.replace("-", "").lower()
153
+ if len(digits) != 32 or digits[12] != "7" or not _CODEX_SESSION_ID_RE.fullmatch(session_id):
154
+ return None
155
+ return int(digits[:12], 16) / 1000.0
156
+
157
+
158
+ def t3_linkage_hold_started_at(
159
+ source_file: str | Path, *, session_header: CompactCodexHeader | None = None, cache: dict | None = None
160
+ ) -> float:
161
+ """When a session's linkage hold began: the session's own start, read from its header id.
162
+
163
+ T3 links a session it adopts within seconds of starting it, so the start is the clock. It lives
164
+ in the data, so a restart, a copied file or a touched mtime cannot restart the hold. A header
165
+ without a UUIDv7 id falls back to the file's mtime, which is never earlier than the start, so
166
+ the fallback only ever holds longer.
167
+ """
168
+ started = None
169
+ try:
170
+ with t3_linkage_alarm.read_only():
171
+ session_id, _ = codex_header_identity(source_file, cache, session_header)
172
+ started = codex_session_started_at(session_id)
173
+ except BrainLayerAlarm:
174
+ started = None
175
+ if started is None:
176
+ try:
177
+ started = Path(source_file).stat().st_mtime
178
+ except OSError:
179
+ started = time.time()
180
+ return started
181
+
182
+
127
183
  def codex_session_id_from_source(source_file: str | Path) -> str | None:
128
184
  """Return the final UUID in a Codex JSONL filename, if present."""
129
185
  matches = _CODEX_SESSION_ID_RE.findall(Path(source_file).stem)
@@ -1762,6 +1762,23 @@ class BatchIndexer:
1762
1762
  logger.error("Batch flush failed (%d items), retaining in buffer: %s", count, e)
1763
1763
  self.total_failed_inputs += self._isolate_failed_flush(batch, e)
1764
1764
 
1765
+ def linkage_holds(self) -> dict[str, float]:
1766
+ """{source file: earliest hold start} for entries the flush deferred for T3 linkage.
1767
+
1768
+ Only the last flush's deferral tag counts: the bridge clears it on every attempt, so an
1769
+ entry deferred for any other reason (an unreadable T3 runtime, a failed write) is not here.
1770
+ """
1771
+ from .t3_provenance import T3_LINKAGE_HOLD_KEY
1772
+
1773
+ holds: dict[str, float] = {}
1774
+ with self._lock:
1775
+ for item in self._buffer:
1776
+ started = item.get(T3_LINKAGE_HOLD_KEY)
1777
+ source = item.get("_source_file")
1778
+ if isinstance(source, str) and isinstance(started, (int, float)) and math.isfinite(started):
1779
+ holds[source] = min(holds.get(source, started), started)
1780
+ return holds
1781
+
1765
1782
  def retained_failed_input_count(self) -> int:
1766
1783
  """Return currently retained flush-failed inputs without counting retry attempts."""
1767
1784
  with self._lock:
@@ -1966,6 +1983,9 @@ class JSONLWatcher:
1966
1983
  self._quarantined_record_count_total = 0
1967
1984
  self._quarantined_records: list[dict[str, Any]] = []
1968
1985
  self._pending_quarantined_offsets: dict[str, list[tuple[int, int, int, int]]] = {}
1986
+ # {file: (read end, offset that must be confirmed first, inode, generation)}: a no-entry
1987
+ # tail whose checkpoint waits for the entries ahead of it (_retry_discarded_progress).
1988
+ self._pending_discarded_progress: dict[str, tuple[int, int, int, int]] = {}
1969
1989
  # Sources confirmed gone (lstat ENOENT). Their tailer and registry checkpoint are kept;
1970
1990
  # a path leaves the set when discovery sees it again (#732).
1971
1991
  self._vanished_sources: set[str] = set()
@@ -2043,6 +2063,33 @@ class JSONLWatcher:
2043
2063
  self._last_offset_prune_attempt = float("-inf")
2044
2064
  self._last_prune_parent_dirs: frozenset[str] | None = None
2045
2065
 
2066
+ def _retry_discarded_progress(self) -> None:
2067
+ """Confirm a remembered no-entry tail once every entry ahead of it is confirmed.
2068
+
2069
+ Same rule as _checkpoint_discarded_progress, applied after a flush: nothing of the file
2070
+ still buffered, the confirmed offset at the last indexable line, and the same tailer, inode
2071
+ and generation that read the bytes. Never past the read end the tailer recorded.
2072
+ """
2073
+ for filepath, (read_end, required, inode, generation) in list(self._pending_discarded_progress.items()):
2074
+ tailer = self._tailers.get(filepath)
2075
+ if (
2076
+ tailer is None
2077
+ or self.registry.generation(filepath) != generation
2078
+ or tailer.observed_inode not in (0, inode)
2079
+ or tailer.offset < read_end
2080
+ ):
2081
+ self._pending_discarded_progress.pop(filepath, None)
2082
+ continue
2083
+ if (
2084
+ self.indexer.has_buffered_source(filepath)
2085
+ or self._pending_quarantined_offsets.get(filepath)
2086
+ or filepath in self._file_ingestion_failures
2087
+ or self.registry.get(filepath)[0] < required
2088
+ ):
2089
+ continue
2090
+ self._pending_discarded_progress.pop(filepath, None)
2091
+ self._advance_confirmed_offsets({filepath: (read_end, inode, generation)})
2092
+
2046
2093
  def _advance_confirmed_offsets(self, confirmations: dict[str, tuple[int, int, int]]) -> None:
2047
2094
  for filepath, (offset, source_inode, source_generation) in confirmations.items():
2048
2095
  current_offset, _current_inode = self.registry.get(filepath)
@@ -2571,17 +2618,38 @@ class JSONLWatcher:
2571
2618
  source_inode: int,
2572
2619
  source_generation: int,
2573
2620
  ) -> None:
2574
- """Confirm intentionally discarded bytes without crossing indexable work."""
2575
- required_confirmed_offset = max(
2621
+ """Confirm intentionally discarded bytes without crossing indexable work.
2622
+
2623
+ When entries ahead of these bytes are still unconfirmed (buffered for the next flush, or
2624
+ held for T3 linkage), the frontier is remembered and retried after a flush
2625
+ (_retry_discarded_progress) instead of dropped: a finished file's no-entry tail would
2626
+ otherwise never be confirmed, because a reader at EOF reads nothing more, and since #1827
2627
+ that tail counts as lag no catch-up round can drain. A later slice with no indexable line
2628
+ extends a contiguous remembered frontier; it never confirms past what the reader read.
2629
+ """
2630
+ slice_required = max(
2576
2631
  (line["_line_end_offset"] for line in normalized_lines if isinstance(line.get("_line_end_offset"), int)),
2577
- default=read_start_offset,
2632
+ default=None,
2578
2633
  )
2634
+ pending = self._pending_discarded_progress.pop(filepath, None)
2635
+ if slice_required is not None:
2636
+ required_confirmed_offset = slice_required
2637
+ elif (
2638
+ pending is not None and pending[0] == read_start_offset and pending[2:] == (source_inode, source_generation)
2639
+ ):
2640
+ required_confirmed_offset = pending[1]
2641
+ else:
2642
+ required_confirmed_offset = read_start_offset
2579
2643
  if read_end_offset <= required_confirmed_offset:
2580
2644
  return
2581
- if self.indexer.has_buffered_source(filepath):
2582
- return
2583
2645
  confirmed_offset, _confirmed_inode = self.registry.get(filepath)
2584
- if confirmed_offset < required_confirmed_offset:
2646
+ if self.indexer.has_buffered_source(filepath) or confirmed_offset < required_confirmed_offset:
2647
+ self._pending_discarded_progress[filepath] = (
2648
+ read_end_offset,
2649
+ required_confirmed_offset,
2650
+ source_inode,
2651
+ source_generation,
2652
+ )
2585
2653
  return
2586
2654
  self._advance_confirmed_offsets(
2587
2655
  {
@@ -2799,6 +2867,61 @@ class JSONLWatcher:
2799
2867
  lags[filepath] = size - offset
2800
2868
  return lags
2801
2869
 
2870
+ def _split_linkage_holds(self, lags: dict[str, int]) -> tuple[dict[str, int], dict[str, int], dict[str, Any]]:
2871
+ """Take bytes held for T3 linkage out of the lag: (drainable lags, read offsets, held_for_linkage).
2872
+
2873
+ A T3-origin Codex session T3 has not linked yet is read but deliberately left unconfirmed
2874
+ until T3 links it or its hold window (t3_linkage_hold_window_s) ends, when the flush
2875
+ indexes it as t3-unlinked. Inside the window those read bytes are not a stall: no catch-up
2876
+ round can drain them and nobody can act on them, so they are published as
2877
+ catch_up.held_for_linkage and never as lag. Bytes not read yet stay ordinary lag, measured
2878
+ from the read offset (returned so the progress check uses it). A hold past its window is
2879
+ not taken out: whatever keeps it unconfirmed is a real fault and stays offset_lag.
2880
+ """
2881
+ from .t3_provenance import t3_linkage_hold_window_s
2882
+
2883
+ window = t3_linkage_hold_window_s()
2884
+ wall_now = time.time()
2885
+ holds = self.indexer.linkage_holds()
2886
+ drainable = dict(lags)
2887
+ read_offsets: dict[str, int] = {}
2888
+ held_files = 0
2889
+ held_bytes = 0
2890
+ oldest_age: float | None = None
2891
+ for filepath, started in holds.items():
2892
+ lag = drainable.get(filepath)
2893
+ tailer = self._tailers.get(filepath)
2894
+ if (
2895
+ lag is None
2896
+ or tailer is None
2897
+ or hasattr(tailer, "decoder")
2898
+ or self._physical_files.get(filepath, filepath).endswith(".zst")
2899
+ or wall_now - started > window
2900
+ ):
2901
+ continue
2902
+ confirmed = self.registry.get(filepath)[0]
2903
+ size = confirmed + lag # a plain file's lag is measured from its confirmed offset
2904
+ read = min(max(tailer.offset, confirmed), size)
2905
+ held = read - confirmed
2906
+ if held <= 0:
2907
+ continue
2908
+ held_files += 1
2909
+ held_bytes += held
2910
+ age = max(0.0, wall_now - started)
2911
+ oldest_age = age if oldest_age is None else max(oldest_age, age)
2912
+ if size > read:
2913
+ drainable[filepath] = size - read
2914
+ read_offsets[filepath] = read
2915
+ else:
2916
+ drainable.pop(filepath)
2917
+ summary = {
2918
+ "files": held_files,
2919
+ "bytes": held_bytes,
2920
+ "oldest_age_s": round(oldest_age, 1) if oldest_age is not None else None,
2921
+ "window_s": window,
2922
+ }
2923
+ return drainable, read_offsets, summary
2924
+
2802
2925
  def _db_realtime_inserts_since_window_start(self) -> int | None:
2803
2926
  if not self.db_path:
2804
2927
  return None
@@ -2949,13 +3072,19 @@ class JSONLWatcher:
2949
3072
  self._db_probe_failed_since = now
2950
3073
  db_probe_failed_for_s = now - self._db_probe_failed_since if db_probe_failed else 0.0
2951
3074
  roots_missing = self._missing_roots(now)
2952
- lags = self._offset_lags(files)
3075
+ # Bytes held for T3 linkage inside their window are not lag (see _split_linkage_holds).
3076
+ lags, held_read_offsets, held_for_linkage = self._split_linkage_holds(self._offset_lags(files))
2953
3077
  max_lag = max(lags.values(), default=0)
2954
3078
  # Measured progress: a plain file's confirmed offset and its registry generation. An
2955
3079
  # archive has no confirmed decoded checkpoint comparable to its physical size, so it gets
2956
3080
  # no entry and can never read as catching up; its lag still raises offset_lag (#1827).
3081
+ # A partly read file held for linkage confirms nothing until its hold ends, so its
3082
+ # progress is its read offset: the unread bytes are what is still draining.
2957
3083
  progress = {
2958
- filepath: (self.registry.get(filepath)[0], self.registry.generation(filepath))
3084
+ filepath: (
3085
+ held_read_offsets.get(filepath, self.registry.get(filepath)[0]),
3086
+ self.registry.generation(filepath),
3087
+ )
2959
3088
  for filepath in lags
2960
3089
  if not self._physical_files.get(filepath, filepath).endswith(".zst")
2961
3090
  }
@@ -2975,6 +3104,8 @@ class JSONLWatcher:
2975
3104
  "last_poll_rounds": self._catch_up_rounds,
2976
3105
  "last_poll_s": round(self._catch_up_s, 3),
2977
3106
  "budget_s": self.catch_up_budget_s,
3107
+ # Visible, never a stall: T3-origin sessions read and waiting for T3 to link them.
3108
+ "held_for_linkage": held_for_linkage,
2978
3109
  }
2979
3110
  all_failure_payloads = [
2980
3111
  {key: value for key, value in failure.items() if key != "_fingerprint"}
@@ -3542,6 +3673,7 @@ class JSONLWatcher:
3542
3673
  self._record_file_ingestion_failure(filepath, error)
3543
3674
 
3544
3675
  self.indexer.tick()
3676
+ self._retry_discarded_progress()
3545
3677
  if self.on_tick:
3546
3678
  try:
3547
3679
  self.on_tick()
@@ -23,7 +23,7 @@ from typing import Any
23
23
 
24
24
  import apsw
25
25
 
26
- from .agent_provenance import classify_provenance, effective_visibility
26
+ from .agent_provenance import ProvenanceDecision, classify_provenance, effective_visibility
27
27
  from .agy_attribution import STATE_FILE_NAME, AgyAttributionGate
28
28
  from .alarm import BrainLayerAlarm
29
29
  from .chunk_origin import detect_chunk_origin
@@ -38,7 +38,13 @@ from .pipeline.classify import classify_content
38
38
  from .pipeline.correction_detection import build_correction_tags
39
39
  from .pipeline.secret_scrub import scrub_secrets
40
40
  from .queue_io import enqueue_watcher_chunk
41
- from .t3_provenance import t3_app_codex_session_ids
41
+ from .t3_provenance import (
42
+ T3_LINKAGE_HOLD_KEY,
43
+ T3_UNLINKED,
44
+ t3_app_codex_session_ids,
45
+ t3_linkage_hold_started_at,
46
+ t3_linkage_hold_window_s,
47
+ )
42
48
  from .t3_sources import resolve_t3_sources
43
49
  from .vector_store import VectorStore
44
50
  from .writer_telemetry import IngestMetrics
@@ -415,6 +421,7 @@ def create_flush_callback(
415
421
  resolved_source_identities: dict[str, tuple[int, int, int]] = {}
416
422
  unresolved_source_versions: dict[str, tuple[int, int] | None] = {}
417
423
  agy_gate = AgyAttributionGate(Path(db_path or get_db_path()).expanduser().parent / STATE_FILE_NAME)
424
+ t3_linkage_released: set[str] = set() # sources whose hold expired, logged once per process
418
425
 
419
426
  def ensure_direct_liveness_schema() -> None:
420
427
  if liveness_schema_ready or store is None:
@@ -460,6 +467,9 @@ def create_flush_callback(
460
467
  source_files_seen: set[str] = set()
461
468
  confirmed_offsets: dict[str, int] = {}
462
469
  t3_session_identity_cache: dict = {}
470
+ t3_linkage_hold_window = t3_linkage_hold_window_s()
471
+ t3_linkage_hold_starts: dict[str, float] = {}
472
+ flush_wall_now = time.time()
463
473
 
464
474
  def confirm_entry(entry: dict[str, Any], source_file: str) -> None:
465
475
  raw_offset = entry.get("_line_end_offset")
@@ -509,6 +519,8 @@ def create_flush_callback(
509
519
  for entry in entries:
510
520
  source_file = entry.get("_source_file", "unknown")
511
521
  source_files_seen.add(source_file)
522
+ # Recomputed on every attempt: only an entry deferred THIS flush for T3 linkage carries it.
523
+ entry.pop(T3_LINKAGE_HOLD_KEY, None)
512
524
  agy_index_now, agy_agent = agy_gate.resolve(source_file)
513
525
  if not agy_index_now:
514
526
  deferred_entries.append(entry)
@@ -529,9 +541,34 @@ def create_flush_callback(
529
541
  t3_session_header=entry.get("_codex_header"),
530
542
  agy_agent=agy_agent,
531
543
  )
532
- except BrainLayerAlarm:
533
- deferred_entries.append(entry)
534
- continue
544
+ except BrainLayerAlarm as alarm_event:
545
+ if alarm_event.code != "t3_runtime_linkage_pending":
546
+ deferred_entries.append(entry)
547
+ continue
548
+ # A T3-origin session T3 has not linked. Hold it for the window, counted from the
549
+ # session's own start; T3 links the sessions it adopts within seconds. Past the
550
+ # window T3 never will (it keeps one Codex session per thread), so index it, labelled
551
+ # t3-unlinked, and confirm it: a hold must never become a permanent gap or a stall.
552
+ if source_file not in t3_linkage_hold_starts:
553
+ t3_linkage_hold_starts[source_file] = t3_linkage_hold_started_at(
554
+ source_file, session_header=entry.get("_codex_header"), cache=t3_session_identity_cache
555
+ )
556
+ hold_started_at = t3_linkage_hold_starts[source_file]
557
+ if flush_wall_now - hold_started_at <= t3_linkage_hold_window:
558
+ entry[T3_LINKAGE_HOLD_KEY] = hold_started_at
559
+ deferred_entries.append(entry)
560
+ continue
561
+ if source_file not in t3_linkage_released:
562
+ t3_linkage_released.add(source_file)
563
+ logger.warning(
564
+ "T3 linkage hold expired after %.0f s for %s; indexing it as %s",
565
+ flush_wall_now - hold_started_at,
566
+ source_file,
567
+ T3_UNLINKED,
568
+ )
569
+ provenance_decision = ProvenanceDecision(
570
+ T3_UNLINKED, "KEEP", "T3-origin Codex session never linked within the hold window", "cli-agent"
571
+ )
535
572
  project = source_projects.get(source_file)
536
573
  if project is None and entry.get("_compressed_archive"):
537
574
  project = _extract_workspace_project(entry)
@@ -1 +0,0 @@
1
- BUILD_SHA = "6f7f7ae4b8ab451896dcf8754cc7ca67a0867086"
File without changes
File without changes
File without changes