tianluo 12.0.0__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 (196) hide show
  1. tianluo-12.0.0/.gitignore +86 -0
  2. tianluo-12.0.0/LICENSE +202 -0
  3. tianluo-12.0.0/NOTICE +4 -0
  4. tianluo-12.0.0/PKG-INFO +349 -0
  5. tianluo-12.0.0/README.md +313 -0
  6. tianluo-12.0.0/README.zh.md +295 -0
  7. tianluo-12.0.0/VERSIONS.md +1703 -0
  8. tianluo-12.0.0/docs/assets/tianluo-icon.png +0 -0
  9. tianluo-12.0.0/docs/daemon-and-server.md +705 -0
  10. tianluo-12.0.0/docs/daemon-and-server.zh.md +622 -0
  11. tianluo-12.0.0/pyproject.toml +138 -0
  12. tianluo-12.0.0/src/se3/__init__.py +69 -0
  13. tianluo-12.0.0/src/tianluo/__init__.py +30 -0
  14. tianluo-12.0.0/src/tianluo/__main__.py +11 -0
  15. tianluo-12.0.0/src/tianluo/agent_runner.py +164 -0
  16. tianluo-12.0.0/src/tianluo/claude_interactive_runner.py +1932 -0
  17. tianluo-12.0.0/src/tianluo/claude_runner.py +980 -0
  18. tianluo-12.0.0/src/tianluo/cli.py +1145 -0
  19. tianluo-12.0.0/src/tianluo/codex_runner.py +1244 -0
  20. tianluo-12.0.0/src/tianluo/commands/__init__.py +1 -0
  21. tianluo-12.0.0/src/tianluo/commands/code_index_cmd.py +336 -0
  22. tianluo-12.0.0/src/tianluo/commands/end_session_cmd.py +1093 -0
  23. tianluo-12.0.0/src/tianluo/commands/history_cmd.py +698 -0
  24. tianluo-12.0.0/src/tianluo/commands/init_cmd.py +634 -0
  25. tianluo-12.0.0/src/tianluo/commands/issue_cmd.py +548 -0
  26. tianluo-12.0.0/src/tianluo/commands/merge/__init__.py +50 -0
  27. tianluo-12.0.0/src/tianluo/commands/merge/failure_reason.py +378 -0
  28. tianluo-12.0.0/src/tianluo/commands/merge/llm_trace.py +284 -0
  29. tianluo-12.0.0/src/tianluo/commands/merge/merge_lock.py +869 -0
  30. tianluo-12.0.0/src/tianluo/commands/merge/postcondition.py +1028 -0
  31. tianluo-12.0.0/src/tianluo/commands/merge/result_model.py +443 -0
  32. tianluo-12.0.0/src/tianluo/commands/merge/secret_redact.py +207 -0
  33. tianluo-12.0.0/src/tianluo/commands/merge_cmd.py +1906 -0
  34. tianluo-12.0.0/src/tianluo/commands/merge_respond.py +954 -0
  35. tianluo-12.0.0/src/tianluo/commands/migrate_cmd.py +990 -0
  36. tianluo-12.0.0/src/tianluo/commands/run.py +4043 -0
  37. tianluo-12.0.0/src/tianluo/commands/salvage_cmd.py +396 -0
  38. tianluo-12.0.0/src/tianluo/commands/worktree_cmd.py +177 -0
  39. tianluo-12.0.0/src/tianluo/config.py +4303 -0
  40. tianluo-12.0.0/src/tianluo/core/__init__.py +1 -0
  41. tianluo-12.0.0/src/tianluo/core/utils.py +40 -0
  42. tianluo-12.0.0/src/tianluo/daemon/__init__.py +60 -0
  43. tianluo-12.0.0/src/tianluo/daemon/aggregator.py +1793 -0
  44. tianluo-12.0.0/src/tianluo/daemon/client.py +2456 -0
  45. tianluo-12.0.0/src/tianluo/daemon/daemon.py +1556 -0
  46. tianluo-12.0.0/src/tianluo/daemon/disk_json_cache.py +662 -0
  47. tianluo-12.0.0/src/tianluo/daemon/history.py +2710 -0
  48. tianluo-12.0.0/src/tianluo/daemon/protocol.py +1103 -0
  49. tianluo-12.0.0/src/tianluo/daemon/spawner.py +763 -0
  50. tianluo-12.0.0/src/tianluo/daemon/supervisor.py +434 -0
  51. tianluo-12.0.0/src/tianluo/daemon/wire_metrics.py +84 -0
  52. tianluo-12.0.0/src/tianluo/engine/__init__.py +59 -0
  53. tianluo-12.0.0/src/tianluo/engine/adjudication.py +666 -0
  54. tianluo-12.0.0/src/tianluo/engine/baseline_fix_memory.py +193 -0
  55. tianluo-12.0.0/src/tianluo/engine/charter.py +376 -0
  56. tianluo-12.0.0/src/tianluo/engine/chat_history.py +2485 -0
  57. tianluo-12.0.0/src/tianluo/engine/code_index.py +1596 -0
  58. tianluo-12.0.0/src/tianluo/engine/code_index_render.py +334 -0
  59. tianluo-12.0.0/src/tianluo/engine/conftest.py +128 -0
  60. tianluo-12.0.0/src/tianluo/engine/context.py +172 -0
  61. tianluo-12.0.0/src/tianluo/engine/context_builder.py +1207 -0
  62. tianluo-12.0.0/src/tianluo/engine/dag_scheduler.py +662 -0
  63. tianluo-12.0.0/src/tianluo/engine/display.py +542 -0
  64. tianluo-12.0.0/src/tianluo/engine/docs_updater.py +814 -0
  65. tianluo-12.0.0/src/tianluo/engine/event_stream.py +188 -0
  66. tianluo-12.0.0/src/tianluo/engine/file_enum.py +225 -0
  67. tianluo-12.0.0/src/tianluo/engine/formatters/__init__.py +20 -0
  68. tianluo-12.0.0/src/tianluo/engine/formatters/task_formatter.py +985 -0
  69. tianluo-12.0.0/src/tianluo/engine/git_tags.py +199 -0
  70. tianluo-12.0.0/src/tianluo/engine/interaction_calls.py +484 -0
  71. tianluo-12.0.0/src/tianluo/engine/issue_discovery.py +576 -0
  72. tianluo-12.0.0/src/tianluo/engine/issue_manager.py +818 -0
  73. tianluo-12.0.0/src/tianluo/engine/json_extractor.py +227 -0
  74. tianluo-12.0.0/src/tianluo/engine/json_modes.py +99 -0
  75. tianluo-12.0.0/src/tianluo/engine/llm_caller.py +2136 -0
  76. tianluo-12.0.0/src/tianluo/engine/logging_config.py +544 -0
  77. tianluo-12.0.0/src/tianluo/engine/merge/__init__.py +123 -0
  78. tianluo-12.0.0/src/tianluo/engine/merge/cleanup.py +1106 -0
  79. tianluo-12.0.0/src/tianluo/engine/merge/conflict_context.py +649 -0
  80. tianluo-12.0.0/src/tianluo/engine/merge/conflict_resolver.py +1063 -0
  81. tianluo-12.0.0/src/tianluo/engine/merge/deterministic_resolvers.py +438 -0
  82. tianluo-12.0.0/src/tianluo/engine/merge/guardrail_repair.py +1834 -0
  83. tianluo-12.0.0/src/tianluo/engine/merge/guardrails.py +1708 -0
  84. tianluo-12.0.0/src/tianluo/engine/merge/human_call.py +798 -0
  85. tianluo-12.0.0/src/tianluo/engine/merge/issue_renumber.py +755 -0
  86. tianluo-12.0.0/src/tianluo/engine/merge/orchestrator.py +6818 -0
  87. tianluo-12.0.0/src/tianluo/engine/merge/reconcile.py +2613 -0
  88. tianluo-12.0.0/src/tianluo/engine/merge/runtime_sync.py +2725 -0
  89. tianluo-12.0.0/src/tianluo/engine/merge/strategy.py +557 -0
  90. tianluo-12.0.0/src/tianluo/engine/merge/version_aggregator.py +1018 -0
  91. tianluo-12.0.0/src/tianluo/engine/merge/worktree_gc.py +428 -0
  92. tianluo-12.0.0/src/tianluo/engine/models.py +1108 -0
  93. tianluo-12.0.0/src/tianluo/engine/output.py +126 -0
  94. tianluo-12.0.0/src/tianluo/engine/output_formatter.py +142 -0
  95. tianluo-12.0.0/src/tianluo/engine/persistence.py +1934 -0
  96. tianluo-12.0.0/src/tianluo/engine/project_context.py +118 -0
  97. tianluo-12.0.0/src/tianluo/engine/prompt_dedup.py +153 -0
  98. tianluo-12.0.0/src/tianluo/engine/prompt_history.py +103 -0
  99. tianluo-12.0.0/src/tianluo/engine/prompt_markers.py +289 -0
  100. tianluo-12.0.0/src/tianluo/engine/retry_context.py +59 -0
  101. tianluo-12.0.0/src/tianluo/engine/runtime_environment.md +54 -0
  102. tianluo-12.0.0/src/tianluo/engine/schema.py +555 -0
  103. tianluo-12.0.0/src/tianluo/engine/sink.py +437 -0
  104. tianluo-12.0.0/src/tianluo/engine/spec_format.py +493 -0
  105. tianluo-12.0.0/src/tianluo/engine/spec_governance.py +133 -0
  106. tianluo-12.0.0/src/tianluo/engine/spec_validator.py +314 -0
  107. tianluo-12.0.0/src/tianluo/engine/spec_write_hook.py +389 -0
  108. tianluo-12.0.0/src/tianluo/engine/stash_utils.py +722 -0
  109. tianluo-12.0.0/src/tianluo/engine/stashpop_llm_resolver.py +186 -0
  110. tianluo-12.0.0/src/tianluo/engine/state_machine.py +3127 -0
  111. tianluo-12.0.0/src/tianluo/engine/step_renderers.py +929 -0
  112. tianluo-12.0.0/src/tianluo/engine/steps/__init__.py +113 -0
  113. tianluo-12.0.0/src/tianluo/engine/steps/_fix_context.py +165 -0
  114. tianluo-12.0.0/src/tianluo/engine/steps/_project_root.py +58 -0
  115. tianluo-12.0.0/src/tianluo/engine/steps/adjudicate.py +1138 -0
  116. tianluo-12.0.0/src/tianluo/engine/steps/analyze.py +419 -0
  117. tianluo-12.0.0/src/tianluo/engine/steps/charter_freshness.py +794 -0
  118. tianluo-12.0.0/src/tianluo/engine/steps/commit.py +1824 -0
  119. tianluo-12.0.0/src/tianluo/engine/steps/confirm.py +389 -0
  120. tianluo-12.0.0/src/tianluo/engine/steps/conftest.py +7 -0
  121. tianluo-12.0.0/src/tianluo/engine/steps/discovery.py +1378 -0
  122. tianluo-12.0.0/src/tianluo/engine/steps/implement.py +2882 -0
  123. tianluo-12.0.0/src/tianluo/engine/steps/invariant_check.py +912 -0
  124. tianluo-12.0.0/src/tianluo/engine/steps/merge_integrate.py +179 -0
  125. tianluo-12.0.0/src/tianluo/engine/steps/plan.py +508 -0
  126. tianluo-12.0.0/src/tianluo/engine/steps/plan_tasks.py +330 -0
  127. tianluo-12.0.0/src/tianluo/engine/steps/project_summary.py +171 -0
  128. tianluo-12.0.0/src/tianluo/engine/steps/self_check.py +1396 -0
  129. tianluo-12.0.0/src/tianluo/engine/steps/summarize.py +600 -0
  130. tianluo-12.0.0/src/tianluo/engine/steps/test.py +1540 -0
  131. tianluo-12.0.0/src/tianluo/engine/steps/test_discovery_recency.py +397 -0
  132. tianluo-12.0.0/src/tianluo/engine/steps/test_project_root_resolution.py +185 -0
  133. tianluo-12.0.0/src/tianluo/engine/steps/test_version_reconcile.py +1219 -0
  134. tianluo-12.0.0/src/tianluo/engine/steps/test_with_fail_loop.py +142 -0
  135. tianluo-12.0.0/src/tianluo/engine/steps/version_analyze.py +956 -0
  136. tianluo-12.0.0/src/tianluo/engine/steps/version_reconcile.py +277 -0
  137. tianluo-12.0.0/src/tianluo/engine/task_description.py +57 -0
  138. tianluo-12.0.0/src/tianluo/engine/test_adjudicate_step.py +1375 -0
  139. tianluo-12.0.0/src/tianluo/engine/test_adjudication.py +403 -0
  140. tianluo-12.0.0/src/tianluo/engine/test_adjudication_effective.py +254 -0
  141. tianluo-12.0.0/src/tianluo/engine/test_baseline.py +558 -0
  142. tianluo-12.0.0/src/tianluo/engine/test_code_index_concurrency.py +662 -0
  143. tianluo-12.0.0/src/tianluo/engine/test_code_index_degrade.py +91 -0
  144. tianluo-12.0.0/src/tianluo/engine/test_e2e.py +692 -0
  145. tianluo-12.0.0/src/tianluo/engine/test_engine.py +1741 -0
  146. tianluo-12.0.0/src/tianluo/engine/test_steps.py +1930 -0
  147. tianluo-12.0.0/src/tianluo/engine/test_version_bumper.py +639 -0
  148. tianluo-12.0.0/src/tianluo/engine/test_version_intent.py +505 -0
  149. tianluo-12.0.0/src/tianluo/engine/token_usage.py +328 -0
  150. tianluo-12.0.0/src/tianluo/engine/tool_formatters.py +854 -0
  151. tianluo-12.0.0/src/tianluo/engine/transitive_reduction.py +89 -0
  152. tianluo-12.0.0/src/tianluo/engine/truncation.py +69 -0
  153. tianluo-12.0.0/src/tianluo/engine/utils/__init__.py +0 -0
  154. tianluo-12.0.0/src/tianluo/engine/utils/json_parser.py +528 -0
  155. tianluo-12.0.0/src/tianluo/engine/version_bumper.py +1561 -0
  156. tianluo-12.0.0/src/tianluo/engine/version_intent.py +1049 -0
  157. tianluo-12.0.0/src/tianluo/engine/version_script_interface.py +439 -0
  158. tianluo-12.0.0/src/tianluo/engine/worktree.py +770 -0
  159. tianluo-12.0.0/src/tianluo/i18n/__init__.py +255 -0
  160. tianluo-12.0.0/src/tianluo/i18n/loader.py +160 -0
  161. tianluo-12.0.0/src/tianluo/i18n/locales/__init__.py +8 -0
  162. tianluo-12.0.0/src/tianluo/i18n/locales/en-US.json +900 -0
  163. tianluo-12.0.0/src/tianluo/i18n/locales/zh-CN.json +899 -0
  164. tianluo-12.0.0/src/tianluo/preset_loader.py +216 -0
  165. tianluo-12.0.0/src/tianluo/runtime_paths.py +78 -0
  166. tianluo-12.0.0/src/tianluo/server/__init__.py +79 -0
  167. tianluo-12.0.0/src/tianluo/server/app.py +2728 -0
  168. tianluo-12.0.0/src/tianluo/server/auth/__init__.py +59 -0
  169. tianluo-12.0.0/src/tianluo/server/auth/base.py +108 -0
  170. tianluo-12.0.0/src/tianluo/server/auth/local.py +124 -0
  171. tianluo-12.0.0/src/tianluo/server/auth/oidc.py +112 -0
  172. tianluo-12.0.0/src/tianluo/server/auth/proxy_header.py +111 -0
  173. tianluo-12.0.0/src/tianluo/server/auth/ratelimit.py +112 -0
  174. tianluo-12.0.0/src/tianluo/server/auth/registry.py +173 -0
  175. tianluo-12.0.0/src/tianluo/server/auth/session.py +239 -0
  176. tianluo-12.0.0/src/tianluo/server/bootstrap.py +134 -0
  177. tianluo-12.0.0/src/tianluo/server/crypto.py +236 -0
  178. tianluo-12.0.0/src/tianluo/server/identity.py +142 -0
  179. tianluo-12.0.0/src/tianluo/server/persistence.py +662 -0
  180. tianluo-12.0.0/src/tianluo/server/state.py +2942 -0
  181. tianluo-12.0.0/src/tianluo/server/static/app.js +15446 -0
  182. tianluo-12.0.0/src/tianluo/server/static/favicon.ico +0 -0
  183. tianluo-12.0.0/src/tianluo/server/static/i18n/en-US.json +535 -0
  184. tianluo-12.0.0/src/tianluo/server/static/i18n/zh-CN.json +535 -0
  185. tianluo-12.0.0/src/tianluo/server/static/index.html +632 -0
  186. tianluo-12.0.0/src/tianluo/server/static/style.css +3884 -0
  187. tianluo-12.0.0/src/tianluo/server/ws.py +1907 -0
  188. tianluo-12.0.0/src/tianluo/templates/__init__.py +23 -0
  189. tianluo-12.0.0/src/tianluo/templates/base_spec.md +71 -0
  190. tianluo-12.0.0/src/tianluo/templates/charter.md +68 -0
  191. tianluo-12.0.0/src/tianluo/templates/prompts/doc-sync.md +104 -0
  192. tianluo-12.0.0/src/tianluo/templates/readme_md.md +45 -0
  193. tianluo-12.0.0/src/tianluo/templates/version_script.py.tmpl +148 -0
  194. tianluo-12.0.0/src/tianluo/templates/versions_md.md +7 -0
  195. tianluo-12.0.0/src/tianluo/utils.py +568 -0
  196. tianluo-12.0.0/tianluo.example.yaml +151 -0
@@ -0,0 +1,86 @@
1
+ # =====================================================================
2
+ # Repository root: ignore everything by default.
3
+ # Stray files dropped at the root (test logs, scratch output, etc.) must
4
+ # NOT be accidentally committed. Only the project files/dirs explicitly
5
+ # un-ignored below are tracked. To track a new top-level entry, add an
6
+ # explicit `!/<name>` (files) or `!/<name>/` (dirs) line here.
7
+ # =====================================================================
8
+ /*
9
+ !/.gitignore
10
+ !/.claude/
11
+ !/LICENSE
12
+ !/NOTICE
13
+ !/README.md
14
+ !/README.zh.md
15
+ !/VERSIONS.md
16
+ !/progress.md
17
+ !/pyproject.toml
18
+ !/tianluo.example.yaml
19
+ !/docs/
20
+ !/scripts/
21
+ !/se3/
22
+ !/tianluo/
23
+ !/src/
24
+ !/tests/
25
+
26
+ # --- Global ignore patterns (apply at any depth) ---
27
+ node_modules/
28
+ .DS_Store
29
+ *.swp
30
+ *.swo
31
+ __pycache__/
32
+ *.pyc
33
+ .pytest_cache/
34
+ .worktrees/
35
+ .collab/
36
+ *.egg-info/
37
+ human-calls/
38
+ issues.md
39
+ prompts/
40
+ # But the built-in preset prompts shipped as package data MUST be tracked
41
+ # (the broad `prompts/` rule above would otherwise swallow them, so the
42
+ # root-cause doc-sync fix could never be committed/shipped).
43
+ !/src/tianluo/templates/prompts/
44
+ e2e
45
+ materials
46
+
47
+ # tianluo runtime dir (post-rename layout): ignore runtime content,
48
+ # whitelist committed artifacts. Mirrors the legacy /se3/* block below so
49
+ # `luo migrate run rename-to-tianluo` on this repo needs no gitignore edit.
50
+ /tianluo/*
51
+ !/tianluo/code-index.md
52
+ !/tianluo/charter.md
53
+ !/tianluo/issues/
54
+ !/tianluo/scripts/
55
+ !/tianluo/prompts/
56
+ !/tianluo/version-rules.md
57
+ !/tianluo/version-intents/
58
+
59
+ # SE3: ignore runtime content, whitelist committed artifacts (legacy layout)
60
+ /se3/*
61
+ !/se3/code-index.md
62
+ !/se3/charter.md
63
+ !/se3/issues/
64
+ !/se3/scripts/
65
+ !/se3/prompts/
66
+ !/se3/version-rules.md
67
+ # Version-reconcile intent metadata: written by a worktree session's commit
68
+ # step and committed on the flow branch so the merge-side reconcile step can
69
+ # read every merged-in branch's intent from master. Must be tracked, unlike
70
+ # the rest of se3/state runtime content that /se3/* ignores.
71
+ !/se3/version-intents/
72
+ tmp*.prompt
73
+
74
+ # SE3 session file
75
+ .claude/.session.json
76
+
77
+ # tianluo local/live project config (not checked in; tianluo.example.yaml
78
+ # is the shipped reference). Legacy se3.* names honoured through 12.x.
79
+ tianluo.local.yaml
80
+ se3.local.yaml
81
+ src/tianluo/__pycache__/
82
+ *.egg-info/
83
+
84
+ # Userspace-installed system libraries for the headless-browser acceptance
85
+ # test (populated by scripts/install_browser_test_libs.sh on no-root hosts).
86
+ .browser-libs/
tianluo-12.0.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Zhendong Zhang (CRE)
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
tianluo-12.0.0/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ tianluo (formerly SE3)
2
+ Copyright 2026 Zhendong Zhang (CRE)
3
+
4
+ This product includes software developed by Zhendong Zhang.
@@ -0,0 +1,349 @@
1
+ Metadata-Version: 2.4
2
+ Name: tianluo
3
+ Version: 12.0.0
4
+ Summary: tianluo (田螺) - autonomous SE 3.0 flow engine: prompt once, walk away, come back to a finished deliverable
5
+ Project-URL: Homepage, https://github.com/CoREse/tianluo
6
+ Project-URL: Repository, https://github.com/CoREse/tianluo
7
+ Project-URL: Changelog, https://github.com/CoREse/tianluo/blob/master/VERSIONS.md
8
+ Project-URL: Issues, https://github.com/CoREse/tianluo/issues
9
+ Author-email: "Zhendong Zhang (CRE)" <zzdzhangzzd@hotmail.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: agent,ai,autonomous,claude,developer-tools,flow-engine,llm,software-engineering
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Software Development :: Build Tools
21
+ Requires-Python: >=3.8
22
+ Requires-Dist: pexpect>=4.8.0
23
+ Requires-Dist: prompt-toolkit>=3.0.0
24
+ Requires-Dist: psutil>=5.9.0
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: rich>=13.0.0
27
+ Requires-Dist: typer>=0.9.0
28
+ Provides-Extra: browser
29
+ Requires-Dist: playwright>=1.40.0; extra == 'browser'
30
+ Provides-Extra: server
31
+ Requires-Dist: argon2-cffi>=21.3.0; extra == 'server'
32
+ Requires-Dist: fastapi>=0.110.0; extra == 'server'
33
+ Requires-Dist: uvicorn>=0.29.0; extra == 'server'
34
+ Requires-Dist: websockets>=12.0; extra == 'server'
35
+ Description-Content-Type: text/markdown
36
+
37
+ <p align="center"><img src="https://raw.githubusercontent.com/CoREse/tianluo/master/docs/assets/tianluo-icon.png" width="128" alt="tianluo icon"></p>
38
+
39
+ # tianluo (田螺) — the Software Engineering 3.0 flow engine
40
+
41
+ ![Version](https://img.shields.io/badge/version-12.0.0-blue)
42
+ ![Python](https://img.shields.io/badge/python-3.8+-green)
43
+ ![License](https://img.shields.io/badge/license-Apache--2.0-lightgrey)
44
+
45
+ **English** | [中文](README.zh.md)
46
+
47
+ > **A project-level, cross-session flow framework where the program — not the human — supervises the AI agent. You prompt once, walk away, and come back to a finished deliverable.**
48
+
49
+ *tianluo is named after the Snail Girl (田螺姑娘) of Chinese folklore: a farmer comes home each day to find the housework quietly finished — the spirit did the work while he was away, never asking, never interrupting. That is this tool's contract. You call it by its short name: the command is `luo`.*
50
+
51
+ tianluo (formerly published as *se3*; the methodology is still called **SE 3.0**) is not a single-session prompting tool, a skill, a subagent, or a dynamic workflow. Those are *in-session* aids that augment one human-in-the-loop turn. tianluo sits one layer above: it is a CLI engine + persistent state machine + a code-first knowledge system (code-index + charter + why-comments) that supervises an AI coding agent across many sessions, on many machines, until the work is actually done.
52
+
53
+ ---
54
+
55
+ ## Design Philosophy
56
+
57
+ ### 1. A different paradigm: program-as-supervisor, human out-of-the-loop
58
+
59
+ Skills, subagents, and dynamic workflows make a *single AI turn* smarter or more parallel. They are valuable, but they assume a human is present, reading output and steering after every step.
60
+
61
+ tianluo makes a different bet. The unit of work is not a turn; it is a **project task**. Between `luo run "…"` and the final commit there may be dozens of LLM calls across plan / implement / test / self-check / invariant-check / commit steps, multiple agent rotations, fix loops, and even multi-machine collaboration via the daemon and central server. The supervisor of all this is the tianluo engine — Python code running a deterministic state machine — not a person watching a terminal.
62
+
63
+ | Tool class | Scope | Who supervises | Where state lives |
64
+ |------------|-------|----------------|-------------------|
65
+ | Skills / subagents / dynamic workflows | One session, one turn (or a fan-out within one turn) | Human in the loop, reading output | Conversation context |
66
+ | **tianluo** | A project task spanning many sessions / machines | The program (engine + daemon) | Persistent files (`tianluo/state/`, `tianluo/history/`, `tianluo/issues/`) |
67
+
68
+ ### 2. The real pain: attention is all you need
69
+
70
+ LLMs are not the bottleneck. *Human attention* is. The cost of any agentic system is measured in how often it forces a person to read, judge, and decide. tianluo's north star is **save human attention**.
71
+
72
+ The ideal tianluo session looks like this:
73
+
74
+ 1. **Prompt** — you type `luo run "…"` (or open a discovery session).
75
+ 2. **Discover** — the engine asks a few targeted clarifying questions until requirements converge.
76
+ 3. **Fire-and-forget** — you walk away. The engine plans, implements, tests, self-checks, checks the diff against recorded invariants, flags any charter drift, bumps the version, and commits.
77
+ 4. **Pick up the deliverable** — you come back to a clean commit on a branch, with the version, history, and code-index already aligned.
78
+
79
+ Steps 1 and 2 are the only places where human attention is genuinely required. Everything else is the program's job.
80
+
81
+ ### 3. The four moats that make this paradigm work
82
+
83
+ A program-as-supervisor paradigm only holds up if the framework provides four things that in-session tools cannot:
84
+
85
+ - **Cross-session state machine** — `tianluo/state/engine.json` persists the exact step, attempt, context, and fix-loop history of every flow. `luo daemon` keeps a resident process supervising local `luo run` flows; `tianluo-server` aggregates many daemons into one web view; `luo run --loop` chains tasks autonomously on isolated git worktrees. The flow survives terminal exits, machine restarts, and hand-offs between machines. *Why this paradigm needs it:* without durable state, "walking away" loses the work.
86
+ - **A code-first knowledge system (code-index + charter + why-comments)** — the source of truth is the code itself. A `tianluo/code-index.md` structure map (auto-maintained, self-freshening) gives the agent an orientation map of *what modules and symbols exist and where*; a small hand-maintained `tianluo/charter.md` carries only the high-altitude facts every step needs in full (project identity, top-level architecture, project-wide invariants); colocated why-comments carry intent the code cannot express. *Why this paradigm needs it:* a long-running unattended agent needs to orient itself in the codebase cheaply on every step without a curated mirror of the code rotting beside it. See [The knowledge system](#the-knowledge-system-code-index--charter--why-comments) below for why this beats the spec-mirror it replaces.
87
+ - **Failure recovery built in** — `luo salvage` rescues a crashed session by committing dangling changes, filing follow-up issues, and archiving the state. The test-baseline cache distinguishes a new regression from a pre-existing red test. Issue discovery promotes any unresolved concern into a tracked `tianluo/issues/` record. *Why this paradigm needs it:* when no human is watching, the framework must catch its own failures rather than leak them.
88
+ - **Portable substrate** — the engine is pure Python over the file system. The LLM call layer is a thin `AgentRunner` adapter; today's concrete runner is the Claude Code CLI, but the abstraction (`AgentRunner` / `RunResult` / `InfraErrorType`) is provider-neutral. *Why this paradigm needs it:* a paradigm bet should not be a single-vendor bet.
89
+
90
+ ### luo vs Claude Code Dynamic Workflows (complementary, not competing)
91
+
92
+ Dynamic Workflows solve *in-session* parallelism: deterministic fan-out, judge panels, pipelines, all inside one orchestrating conversation. They make a single turn comprehensive and confident.
93
+
94
+ tianluo solves *cross-session* project governance: persistent state, a code-first knowledge system, failure recovery, and a portable substrate that outlives any single conversation.
95
+
96
+ The two compose. A future tianluo step can delegate its in-step parallel work to a Dynamic Workflow without changing tianluo's outer state machine. We deliberately do not pin to specific DW API names here, because DW is still in research preview and its surface will evolve.
97
+
98
+ ---
99
+
100
+ ## The knowledge system: code-index + charter + why-comments
101
+
102
+ Earlier tianluo versions kept a parallel corpus of `tianluo/specs/**/spec.md` files — a curated prose mirror of the code — plus an entire governance machine to keep it from drifting: `luo sync` rounds, per-requirement drift baselines, `verify_spec` / `update_spec` / `spec_gate` flow steps, and the whole `sync_*` analyzer/loop/state/discovery stack. tianluo replaced that mirror with three colocated artifacts whose source of truth is the code itself.
103
+
104
+ ### The three pieces
105
+
106
+ - **code-index** — a *structure map* of the project. Its structure comes deterministically from the code (a filesystem walk + Python AST symbol enumeration: directory/package → file/module → class → function/method); a one-line LLM summary, synthesized bottom-up (a directory's summary from its files', a file's from its symbols'), is attached to each level. It lands as **one self-sufficient file**, `tianluo/code-index.md` — the **authoritative product, committed to git**. It *is* the map, and it is what `luo code-index` renders and what gets injected into every flow step. Because it is plain text in a diff, a wrong summary can be spotted by a human reviewer and corrected, and the correction lands durably. Each node line also carries an embedded content fingerprint (a terse, render-invisible HTML comment), so the committed md *alone* decides what changed: on rebuild only fingerprint-changed nodes are re-summarized by the LLM, unchanged nodes reuse their existing summary (so human corrections survive), and the md is flushed periodically during a build so a crash resumes from where it stopped. There is no separate cache file — structure, summaries, and fingerprints all live in the one committed, human-diffable file.
107
+
108
+ The structure comes from the **code**, not the json; the json is just a rebuild accelerator. Display reads only the `.md`. The optimization goal is **structural coverage, not summary depth** — the map answers *which modules/symbols exist and where*, and deliberately does not descend into implementation detail (that is the source code's job; copying it into the index would just reproduce a worse-than-code mirror).
109
+
110
+ - **charter** — `tianluo/charter.md`, the slimmed, renamed successor of the old base spec. It is injected, in full, into every step, and doubles as the conventions channel for sandboxed sub-processes (which cannot read `CLAUDE.md`). An *altitude gate* admits only what is **un-sayable in code and needed in full by the whole project**: project identity, top-level architecture, and project-wide cross-cutting invariants. The per-module locator index that used to bloat the base spec is gone — that job belongs to code-index. A byte threshold is a monitoring light, not a hard wall: because charter content is decoupled from project size (it grows with architectural complexity, not LOC), full-loading it stays cheap even on large projects; if it ever grows hard to load in full, that is a red flag that low-altitude content leaked in — not a reason to build an index over the charter.
111
+
112
+ - **why-comments** — colocated comments that carry *only* the why/intent that code cannot express, updated only when the why changes. They are not a source for code-index, so there is no per-change synchronization tax; the implement step's prompt simply asks the agent to update the colocated why-comment when a change's intent changes. This is honestly a prompt-level soft convention (same strength as the other conventions), pressing the comment-discipline surface to its minimum rather than eliminating it.
113
+
114
+ ### What actually got better (an honest accounting)
115
+
116
+ This refactor does **not** make code descriptions more semantically correct: an LLM-generated summary can be wrong in exactly the same way a hand-written spec was. The real gains are elsewhere:
117
+
118
+ - **Source of truth returns to the code.** Navigation and intent live next to the code, not in a separate corpus that has to be kept honest.
119
+ - **Staleness is eliminated.** code-index regenerates incrementally with zero discipline required: a deterministic enumerator re-walks the tree every build, so a newly added symbol is enumerated, a deleted one is pruned, and only fingerprint-changed symbols are re-summarized. Completeness is a *property of the enumerator*, not of LLM diligence — the LLM only summarizes the symbols it is handed and never decides who is included, so it cannot omit a symbol, and a mis-summarized line still appears on the map.
120
+ - **The governance maintenance surface collapses.** The entire `sync_*` stack, `verify_spec`, `update_spec`, `spec_gate`, the per-requirement drift baselines, and the old `spec_check` all retire. What remains is two cheap, anchored checks: `INVARIANT_CHECK` (does the diff violate any *already-recorded* binding invariant — anchored to {task description, charter, the touched code's why-comments}?) and `CHARTER_FRESHNESS` (an advisory that flags only when the diff plausibly touches one of charter's content classes, and otherwise passes for free).
121
+ - **Granularity and admission become explicit knobs.** code-index granularity bottoms out at each file's smallest *natural* semantic unit (code → function/method; structured non-code → its natural unit; opaque files → one file-level line), with line/byte chunking only as a last-resort degrade mode gated behind three simultaneous conditions; the four thresholds are exposed in `tianluo.yaml` (`spec_governance:`). Charter content is gated by an admission standard you can read and enforce. Both are dials you turn, not emergent behavior you fight.
122
+ - **Charter volume is decoupled from project scale.** It grows with architecture, not lines of code.
123
+ - **The failure floor is higher than the old system's.** Even if every soft discipline lapses, the one automatically-maintained artifact — code-index — stays self-fresh. The system's worst case is therefore strictly better than the old system's worst case of *a rotting spec corpus + grep*.
124
+
125
+ ### A concrete before/after — and why spec-index could never win this
126
+
127
+ Take the old `spec_index.py` (~1130 lines — itself retired by this very refactor) as a worked example. Suppose you need to answer a *navigation* question about it: where is it, what does it do, what are its key symbols?
128
+
129
+ Without a code-index, you have to read the whole ~1130-line file into context to answer even that. With a code-index, you first read the few map lines about that file — for instance, *"builds an item-level spec index, incremental invalidation via mtime + size + sha256; key symbols `load_or_build` / `_make_summary` / `_extract_locator` / `_h4_dividers`."* Navigation questions never touch the source. And a *precise* question — say, the exact boundary condition of one heuristic — needs only a pinpoint read of those ~30 lines, not the whole file.
130
+
131
+ **The comparison with spec-index is the sharpest point.** A spec / spec-index has an upside that is *fundamentally capped by living one layer above the code*: even assuming a spec were perfectly accurate and perfectly complete, it still sits at spec altitude and cannot surface the actual code-level detail — so after it locates the file for you, you still have to go back and read the code, and to be thorough you have to read all of it. The spec's likely inaccuracy and incompleteness is merely insult on top of that injury; it is **not** the reason it loses to code-index. code-index is not subject to this cap at the root, because its source of truth *is* the code and it walks you straight to those ~30 lines.
132
+
133
+ This is exactly the **coverage > depth** bet cashing out: the map's job is to tell you which ~30 lines to flip to — not to replace those ~30 lines. And that context saving is not a one-time win: it compounds on **every step of every flow**, which is precisely the cost code-index exists to cut.
134
+
135
+ > Historical decisions and retained-but-removed intent (e.g. a feature pulled out while its intent is kept on record) do not enter the charter; they continue through the issue channel (`luo issue`). Cross-file architectural decisions with no single owner enter the charter, hand-maintained, accepting that they cannot be auto-synced.
136
+
137
+ ---
138
+
139
+ ## Installation
140
+
141
+ ```bash
142
+ # Core CLI (Python 3.8+)
143
+ pip install tianluo
144
+
145
+ # With the central server / web console
146
+ pip install 'tianluo[server]'
147
+
148
+ # With the headless-browser acceptance test (needs `playwright install chromium` afterwards)
149
+ pip install 'tianluo[browser]'
150
+ ```
151
+
152
+ Current version: **12.0.0**. The installed console scripts:
153
+
154
+ | Script | Purpose |
155
+ |--------|---------|
156
+ | `luo` | **The** command. Short for tianluo — you write `tianluo` down, you call `luo` to work. |
157
+ | `tianluo` | Full-name entry, identical to `luo` (docs, demos, discoverability) |
158
+ | `se3` | Transitional alias from the rename; prints a migration notice, removed in 13.0.0 |
159
+ | `tianluo-server` | Central web server (only with the `server` extra) |
160
+ | `se3-server` | Transitional alias for `tianluo-server`, removed in 13.0.0 |
161
+
162
+ The core CLI never imports the web stack, so installing without `[server]` keeps the dependency surface minimal.
163
+
164
+ > Prefer a two-letter command? `alias tl=luo` — we deliberately don't ship `tl`
165
+ > (the Teal compiler owns it, and two competing short commands would split the
166
+ > docs and community vocabulary).
167
+
168
+ ### Migrating an existing se3 project
169
+
170
+ Everything keeps working unchanged through 12.x: the `se3` command, a legacy
171
+ `se3/` runtime directory, and `se3.yaml` / `se3.local.yaml` configs are all
172
+ still honoured. To move a project to the new layout in one reviewable,
173
+ `git revert`-able commit:
174
+
175
+ ```bash
176
+ luo migrate run rename-to-tianluo # git mv se3/ → tianluo/, config renames, .gitignore rewrite
177
+ ```
178
+
179
+ All legacy fallbacks are removed in **13.0.0**.
180
+
181
+ ---
182
+
183
+ ## Quick Start
184
+
185
+ ```bash
186
+ # 1. Initialize a project (creates tianluo.yaml, tianluo/charter.md, .gitignore, git repo)
187
+ cd your-project
188
+ luo init
189
+
190
+ # 2. Optional: explore vague requirements through multi-turn discovery first
191
+ luo run --discover "I want a CLI tool that does X"
192
+
193
+ # 3. Run a task end-to-end (analyze → plan → implement → test → self_check →
194
+ # invariant_check → charter_freshness → version_analyze → commit → summarize)
195
+ luo run "Add JWT authentication"
196
+
197
+ # 4. Resume an interrupted flow exactly where it stopped
198
+ luo run --resume
199
+
200
+ # 5. Navigate the codebase via the structure map
201
+ luo code-index # adaptive root map: a budgeted, zoomable directory tree
202
+ luo code-index index src/tianluo/engine # drill one literal level (a directory's immediate children)
203
+ luo code-index show src/tianluo/cli.py # one file's full function/method detail
204
+ ```
205
+
206
+ ### Three operating modes
207
+
208
+ - **`--loop`** — Run tasks back-to-back on an isolated git worktree branch
209
+ (`loop/<slug>-<n>`). Each iteration gets its own clean working tree; the
210
+ branch is auto-merged or auto-discarded when the loop ends, or preserved
211
+ for deferred merge if you Ctrl-C.
212
+ - **`luo daemon start`** — Launch a resident background process that
213
+ supervises every local `luo run`, aggregates state under
214
+ `tianluo/state|logs|calls|issues`, and (optionally) dials out to a central
215
+ server. Lets you check on a flow from anywhere.
216
+ - **`tianluo-server`** — A FastAPI + WebSocket central server (with a bundled
217
+ static web console at `/`) that merges many daemons into one multi-machine
218
+ view. Useful for fleets, remote launch, and watching long-running flows
219
+ from a browser. Defaults to `127.0.0.1:8080`.
220
+
221
+ #### Web console authentication
222
+
223
+ The central server is a multi-tenant control plane — the web console and REST
224
+ API require a login, and every machine / flow is scoped to the owner that owns
225
+ it. The first-run flow is:
226
+
227
+ 1. **Mint a break-glass admin token** — run `tianluo-server bootstrap-token` once;
228
+ it prints a one-time admin token to the console.
229
+ 2. **Log in** — open the web console and exchange the token for the break-glass
230
+ admin session (`POST /api/auth/breakglass`).
231
+ 3. **Create local users** — as admin, invite/create accounts (`POST /api/users`).
232
+ v1 has no public self-service registration.
233
+ 4. **Issue a daemon key** — each owner self-mints a daemon key in the UI
234
+ (`POST /api/daemon-keys`), then binds a worker with
235
+ `luo daemon start --daemon-key <key>`. The owner only ever sees their own
236
+ machines and flows.
237
+
238
+ See [docs/daemon-and-server.md](docs/daemon-and-server.md#authentication--multi-tenant-access)
239
+ for the full end-to-end auth walkthrough and configuration keys.
240
+
241
+ ---
242
+
243
+ ## Command Reference
244
+
245
+ All commands found below are present in `src/tianluo/cli.py` or its registered
246
+ sub-typers as of version 12.0.0.
247
+
248
+ ### Top-level commands
249
+
250
+ | Command | Purpose |
251
+ |---------|---------|
252
+ | `luo run [TASK]` | Unified entry point. Drives the flow engine state machine (analyze → plan → implement → test → self_check → invariant_check → charter_freshness → version_analyze → commit → summarize). Supports `--resume`, `--flow-id`, `--loop`, `--max-iterations`, `--no-worktree`, `--merge`, `--list-loops`, `--discover`, `--from-issue`, `--change`, `--type`, `--preset`, `--output-format`. |
253
+ | `luo init` | Initialize a new project: writes `tianluo.yaml`, `tianluo/charter.md`, `.gitignore`, and runs `git init` if needed. Flags: `--project-root`, `--name`, `--force`. |
254
+ | `luo code-index` | Render the **adaptive root map** from `tianluo/code-index.md`: a byte-budgeted, zoomable directory tree (top level always shown; code directories expanded a few levels deep within the budget). This is the same map injected into every flow step. Reads the committed map (reports "not built" until you run `rebuild`); flow steps keep it fresh lazily/incrementally. |
255
+ | `luo code-index index [PATH]` | Render exactly **one literal level** at `PATH`: a directory's immediate children (subdirs + files), or a file's functions/methods. No argument → the literal root level. Unlike the bare command, it never auto-expands. |
256
+ | `luo code-index show <path>` | Print one file's full function/method detail (and any degraded chunks) from the structure map. |
257
+ | `luo code-index rebuild [--force]` | Rebuild the code-index, flushing the md periodically as a checkpoint. Incremental by default (only fingerprint-changed nodes are re-summarized); `--force` re-summarizes everything. |
258
+ | `luo code-index inspect` | Show code-index stats (file / symbol / degraded-chunk counts) from the on-disk map. |
259
+ | `luo migrate run <id>` / `luo migrate list` | Run a registered version/format migration (`run <id>`), or list the available migrators (`list`). A reusable registry skeleton; the first migrator (`spec-to-new-system`) converts a legacy `tianluo/specs/` project to the code-index + charter + why-comments system in one reviewable, `git revert`-able change. |
260
+ | `luo guardrails <spec-file>` | Run tianluo guardrails on a file (deleted-line / weakened-language detection); `--sizes` runs project-wide size checks. Used by `luo merge`. Flag: `--original` / `-o <baseline-file>`. |
261
+ | `luo merge <branch> [<branch> ...]` | Sequentially merge branches into HEAD with LLM-driven conflict resolution. Flags: `--strategy fast\|safe\|strict`, `--delete-merged` / `--no-delete-merged`. Runtime data under `tianluo/` is synchronized per the tiered policy. |
262
+ | `luo merge-respond <call-file>` | Apply a human decision file produced by `luo merge` when conflicts or guardrail violations escalated to a human MCP call. |
263
+ | `luo salvage` | Best-effort recovery of an abnormally terminated session: tolerant state load, commit dangling diff, file follow-up issues, archive the session. Flag: `--project-root` / `-p <path>`. |
264
+
265
+ ### `luo history` — flow history
266
+
267
+ | Subcommand | Purpose |
268
+ |------------|---------|
269
+ | `luo history` / `luo history list` | List flows across active state, archived state, and history-only directories. Flags: `--active-only`, `--archived-only`, `--json`. |
270
+ | `luo history show <flow_id>` | Show structured step-by-step details. Flags: `--detailed` (LLM call breakdown), `--verbose` (full tool-call stream), `--json`. |
271
+ | `luo history restore <flow_id>` | Resume a specific flow by ID (delegates to `luo run --resume --flow-id`). `--dry-run` prints the command without executing. |
272
+ | `luo history archived` | List only archived flows. `--json` for machine-readable output. |
273
+
274
+ ### `luo issue` — project issues
275
+
276
+ | Subcommand | Purpose |
277
+ |------------|---------|
278
+ | `luo issue` / `luo issue list` | List open issues (default). `--all` includes closed; `--type <t>` filters by type. |
279
+ | `luo issue show <id>` | Render an issue's full details. |
280
+ | `luo issue create` | Interactively create a new issue (title, description, type, priority, tags). |
281
+ | `luo issue reset <id>` | Reset an in-progress issue back to `open`. |
282
+
283
+ ### `luo daemon` — resident control plane
284
+
285
+ | Subcommand | Purpose |
286
+ |------------|---------|
287
+ | `luo daemon start` | Start the daemon. `--foreground` keeps it attached; `--server-url <ws://…>` registers with a central server; `--daemon-key <key>` binds this machine to an owner on a multi-tenant server. |
288
+ | `luo daemon stop` | Stop the running daemon. |
289
+ | `luo daemon status` | Report run state, machine id, server URL, real connection state, and tracked flows. `--json` for machine-readable output. |
290
+
291
+ ---
292
+
293
+ ## Directory Layout
294
+
295
+ Everything under `tianluo/` is gitignored by default *except* the whitelisted
296
+ sub-paths shown below (the code-index map, charter, issues, scripts, prompts,
297
+ and `version-rules.md` are tracked; runtime state and logs are not).
298
+
299
+ ```
300
+ your-project/
301
+ ├── tianluo.yaml # Project config (tracked)
302
+ ├── tianluo.local.yaml # Local override (gitignored)
303
+ ├── pyproject.toml # Single source of truth for project version
304
+ ├── VERSIONS.md # Changelog (maintained by documentation-updater)
305
+ ├── scripts/ # Helper scripts
306
+ ├── .gitignore # Written / extended by `luo init`
307
+ └── tianluo/ # tianluo runtime root
308
+ ├── code-index.md # ✅ tracked — authoritative structure map (LLM-injected, human-reviewable)
309
+ ├── charter.md # ✅ tracked — project identity / architecture / invariants, injected in full every step
310
+ ├── issues/ # ✅ tracked — open/ and closed/ YAML records
311
+ ├── prompts/ # ✅ tracked — project-level preset prompt bodies (luo run --preset)
312
+ ├── version-rules.md # ✅ tracked — optional, not present by default
313
+ ├── state/ # ❌ runtime — engine.json, …
314
+ │ └── archive/ # archived engine snapshots
315
+ ├── history/ # ❌ runtime — per-flow per-step jsonl conversations
316
+ ├── logs/ # ❌ runtime — execution logs (incl. logs/llm/ traces)
317
+ ├── calls/ # ❌ runtime — pending human MCP call files
318
+ ├── cache/ # ❌ runtime — derived caches (build locks, etc.)
319
+ ├── tmp/ # ❌ runtime — transient prompt/response snapshots
320
+ └── worktrees/ # ❌ runtime — loop-mode / DAG isolation worktrees
321
+ ```
322
+
323
+ ---
324
+
325
+ ## Navigating the codebase
326
+
327
+ The code-index *is* the index into this codebase. Start at the root view and
328
+ drill down — you read the map's few lines first, and open source files only
329
+ when you need the implementation detail behind a specific symbol:
330
+
331
+ ```bash
332
+ luo code-index # the adaptive root map (budgeted zoomable tree)
333
+ luo code-index index src/tianluo/engine # one level: the engine package's immediate children
334
+ luo code-index show src/tianluo/engine/code_index.py # that file's full symbol tree
335
+ ```
336
+
337
+ The same root-view map is injected automatically into every flow step, so the
338
+ agent always carries a project-wide orientation map; deeper function-level
339
+ detail is fetched on demand. Charter (`tianluo/charter.md`) is injected in full
340
+ alongside it and carries the high-altitude facts — project identity, top-level
341
+ architecture, and project-wide invariants — that every step needs to see whole.
342
+
343
+ ---
344
+
345
+ ## Version & License
346
+
347
+ - Version is owned by `pyproject.toml` (`12.0.0`) and bumped by the engine's `version_analyze` + `commit` steps. Do not hand-edit it.
348
+ - License: Apache-2.0.
349
+ - See [VERSIONS.md](VERSIONS.md) for the full changelog.