principles 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +120 -0
  3. data/README.md +10 -6
  4. data/lib/principles/command_line.rb +15 -6
  5. data/lib/principles/command_routes.rb +11 -1
  6. data/lib/principles/controllers/acknowledgement.rb +19 -4
  7. data/lib/principles/controllers/acknowledgements.rb +43 -12
  8. data/lib/principles/controllers/after_commit_report.rb +15 -2
  9. data/lib/principles/controllers/assessment.rb +7 -3
  10. data/lib/principles/controllers/audit.rb +17 -8
  11. data/lib/principles/controllers/audit_completion.rb +34 -9
  12. data/lib/principles/controllers/carrier_practices.rb +26 -0
  13. data/lib/principles/controllers/command.rb +29 -2
  14. data/lib/principles/controllers/correction.rb +15 -5
  15. data/lib/principles/controllers/full_audit_request.rb +38 -42
  16. data/lib/principles/controllers/inventory.rb +77 -71
  17. data/lib/principles/controllers/last_record_notice_beside.rb +51 -0
  18. data/lib/principles/controllers/member_addition.rb +19 -4
  19. data/lib/principles/controllers/member_entries.rb +25 -6
  20. data/lib/principles/controllers/member_problems_report.rb +26 -6
  21. data/lib/principles/controllers/members_a_commit_changed.rb +14 -5
  22. data/lib/principles/controllers/members_in_logged_requests.rb +52 -0
  23. data/lib/principles/controllers/members_to_assess.rb +24 -7
  24. data/lib/principles/controllers/meta_principle_setup.rb +2 -2
  25. data/lib/principles/controllers/open_correction.rb +3 -2
  26. data/lib/principles/controllers/parts_to_read.rb +46 -5
  27. data/lib/principles/controllers/plugin_member_addition.rb +48 -0
  28. data/lib/principles/controllers/principle_listing.rb +84 -0
  29. data/lib/principles/controllers/request_logging.rb +52 -0
  30. data/lib/principles/controllers/running_tool.rb +39 -13
  31. data/lib/principles/data/branches_bringing_in.rb +52 -0
  32. data/lib/principles/data/changes_since.rb +56 -0
  33. data/lib/principles/data/claude_code_home.rb +58 -0
  34. data/lib/principles/data/command-steps.json +91 -15
  35. data/lib/principles/data/decoded_leaf.rb +63 -0
  36. data/lib/principles/data/head_reflog.rb +13 -2
  37. data/lib/principles/data/kept_line.rb +32 -0
  38. data/lib/principles/data/known_marketplaces.rb +50 -0
  39. data/lib/principles/data/logged_request_matches.rb +138 -0
  40. data/lib/principles/data/logged_request_scan.rb +120 -0
  41. data/lib/principles/data/map_files.rb +18 -4
  42. data/lib/principles/data/plugin_folder.rb +85 -0
  43. data/lib/principles/data/plugin_registry.rb +73 -0
  44. data/lib/principles/data/principles_store.rb +49 -0
  45. data/lib/principles/data/ran.rb +25 -0
  46. data/lib/principles/data/raw_request_filter.rb +61 -0
  47. data/lib/principles/data/repository.rb +29 -27
  48. data/lib/principles/data/request_logging_folder.rb +167 -0
  49. data/lib/principles/data/running_version.rb +1 -1
  50. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +16 -1
  51. data/lib/principles/data/schemas/acknowledgements-answer.schema.json +16 -1
  52. data/lib/principles/data/schemas/assessment-answer.schema.json +8 -0
  53. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  54. data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
  55. data/lib/principles/data/schemas/correction-answer.schema.json +14 -0
  56. data/lib/principles/data/schemas/member-map.schema.json +10 -1
  57. data/lib/principles/data/string_counts.rb +39 -0
  58. data/lib/principles/data/tools_on_path.rb +25 -0
  59. data/lib/principles/invocation_options.rb +4 -2
  60. data/lib/principles/launch.rb +14 -4
  61. data/lib/principles/models/acknowledged_check.rb +11 -1
  62. data/lib/principles/models/acknowledgement.rb +5 -0
  63. data/lib/principles/models/acknowledgement_refusal.rb +20 -11
  64. data/lib/principles/models/acknowledgements_to_offer.rb +86 -0
  65. data/lib/principles/models/after_commit_input.rb +5 -0
  66. data/lib/principles/models/answer_fields.rb +3 -0
  67. data/lib/principles/models/assessment_basis.rb +10 -3
  68. data/lib/principles/models/audit.rb +10 -10
  69. data/lib/principles/models/audit_record.rb +10 -0
  70. data/lib/principles/models/audit_records.rb +4 -3
  71. data/lib/principles/models/audit_start.rb +9 -0
  72. data/lib/principles/models/authored_locator.rb +33 -0
  73. data/lib/principles/models/candidate_files.rb +23 -3
  74. data/lib/principles/models/candidate_outline.rb +18 -125
  75. data/lib/principles/models/captured_sessions.rb +128 -0
  76. data/lib/principles/models/carrier_kind.rb +79 -0
  77. data/lib/principles/models/cited_files.rb +12 -3
  78. data/lib/principles/models/decided_prior_findings.rb +5 -0
  79. data/lib/principles/models/disposition.rb +37 -6
  80. data/lib/principles/models/disposition_placeholders.rb +12 -0
  81. data/lib/principles/models/disposition_text_field.rb +4 -0
  82. data/lib/principles/models/feature.rb +53 -0
  83. data/lib/principles/models/finding_outcomes.rb +55 -0
  84. data/lib/principles/models/findings_left_open.rb +9 -11
  85. data/lib/principles/models/head_moves.rb +27 -10
  86. data/lib/principles/models/installed_component.rb +55 -0
  87. data/lib/principles/models/installed_plugins.rb +174 -0
  88. data/lib/principles/models/kept_sessions.rb +34 -0
  89. data/lib/principles/models/locator.rb +8 -0
  90. data/lib/principles/models/logged_request_reach.rb +44 -0
  91. data/lib/principles/models/logged_request_scan_completeness.rb +43 -0
  92. data/lib/principles/models/mapped_baseline.rb +46 -0
  93. data/lib/principles/models/maps_holding_file_whole.rb +42 -0
  94. data/lib/principles/models/markdown_text.rb +143 -0
  95. data/lib/principles/models/member.rb +14 -1
  96. data/lib/principles/models/member_entry.rb +56 -0
  97. data/lib/principles/models/member_lines.rb +11 -0
  98. data/lib/principles/models/member_loads.rb +17 -2
  99. data/lib/principles/models/member_problems.rb +45 -42
  100. data/lib/principles/models/member_reach.rb +36 -0
  101. data/lib/principles/models/member_snapshots.rb +23 -4
  102. data/lib/principles/models/member_text_as_sent.rb +31 -0
  103. data/lib/principles/models/member_texts.rb +45 -0
  104. data/lib/principles/models/members_in_logged_requests.rb +240 -0
  105. data/lib/principles/models/missing_files.rb +41 -16
  106. data/lib/principles/models/nearly_matching_maps.rb +56 -0
  107. data/lib/principles/models/open_correction.rb +5 -0
  108. data/lib/principles/models/open_finding.rb +4 -3
  109. data/lib/principles/models/outline_budget.rb +10 -1
  110. data/lib/principles/models/outline_item.rb +25 -0
  111. data/lib/principles/models/outline_section.rb +15 -4
  112. data/lib/principles/models/part_named.rb +16 -2
  113. data/lib/principles/models/plugin_component.rb +37 -0
  114. data/lib/principles/models/plugin_install.rb +33 -0
  115. data/lib/principles/models/plugin_name.rb +23 -0
  116. data/lib/principles/models/plugin_reference.rb +53 -0
  117. data/lib/principles/models/principle_members.rb +15 -0
  118. data/lib/principles/models/prior_finding_decision.rb +1 -1
  119. data/lib/principles/models/prior_finding_outcomes.rb +12 -1
  120. data/lib/principles/models/problem_report.rb +14 -25
  121. data/lib/principles/models/project.rb +35 -29
  122. data/lib/principles/models/project_history.rb +19 -5
  123. data/lib/principles/models/recorded_members.rb +7 -0
  124. data/lib/principles/models/request_logging.rb +196 -0
  125. data/lib/principles/models/runs_from.rb +0 -5
  126. data/lib/principles/models/script_comments.rb +58 -0
  127. data/lib/principles/models/stale_request.rb +9 -0
  128. data/lib/principles/models/unfixed_part.rb +82 -0
  129. data/lib/principles/models/unresolved_plugin_members.rb +35 -0
  130. data/lib/principles/models/whole_file_member_read.rb +48 -0
  131. data/lib/principles/models/without_prose.rb +20 -0
  132. data/lib/principles/models/workflow_jobs.rb +92 -0
  133. data/lib/principles/show_members_in_logged_requests_options.rb +27 -0
  134. data/lib/principles/show_principle_options.rb +32 -0
  135. data/lib/principles/version.rb +2 -2
  136. data/lib/principles/views/acknowledged_result.rb +31 -12
  137. data/lib/principles/views/acknowledgement_result.rb +18 -13
  138. data/lib/principles/views/acknowledgement_template_alone.rb +55 -0
  139. data/lib/principles/views/acknowledgements_offered.rb +54 -0
  140. data/lib/principles/views/added_member.rb +22 -6
  141. data/lib/principles/views/answer_in_a_file.rb +15 -15
  142. data/lib/principles/views/assessed_members.rb +18 -7
  143. data/lib/principles/views/assessment_request.rb +8 -3
  144. data/lib/principles/views/audit_changes.rb +14 -8
  145. data/lib/principles/views/audit_findings.rb +34 -0
  146. data/lib/principles/views/audit_result.rb +14 -19
  147. data/lib/principles/views/carrier_checks.rb +40 -0
  148. data/lib/principles/views/carrier_practices_page.rb +49 -0
  149. data/lib/principles/views/completed_audit_findings.rb +33 -0
  150. data/lib/principles/views/completed_audit_next_step.rb +12 -4
  151. data/lib/principles/views/consecutive_sections_elsewhere.rb +4 -0
  152. data/lib/principles/views/context_parts.rb +129 -25
  153. data/lib/principles/views/correction_request.rb +21 -16
  154. data/lib/principles/views/disposition_template.rb +35 -0
  155. data/lib/principles/views/first_audit.rb +29 -15
  156. data/lib/principles/views/first_audit_line.rb +4 -5
  157. data/lib/principles/views/invocation.rb +14 -5
  158. data/lib/principles/views/last_record_notice.rb +41 -0
  159. data/lib/principles/views/lines_shared_with_member.rb +16 -22
  160. data/lib/principles/views/logged_request_status_meanings.rb +29 -0
  161. data/lib/principles/views/logged_requests_evidence.rb +69 -0
  162. data/lib/principles/views/map_added_to.rb +14 -12
  163. data/lib/principles/views/map_result.rb +39 -17
  164. data/lib/principles/views/member_change_since_baseline.rb +4 -0
  165. data/lib/principles/views/member_row.rb +13 -4
  166. data/lib/principles/views/member_sets_overlap.rb +31 -0
  167. data/lib/principles/views/members_a_commit_changed.rb +42 -25
  168. data/lib/principles/views/members_changed_during_audit.rb +27 -0
  169. data/lib/principles/views/members_in_logged_requests_result.rb +68 -0
  170. data/lib/principles/views/members_too_short_to_scan.rb +45 -0
  171. data/lib/principles/views/members_with_no_baseline.rb +6 -6
  172. data/lib/principles/views/meta_principle_result.rb +14 -2
  173. data/lib/principles/views/open_findings_line.rb +31 -92
  174. data/lib/principles/views/parts_index_result.rb +9 -5
  175. data/lib/principles/views/principle_read_result.rb +52 -11
  176. data/lib/principles/views/prior_findings_result.rb +9 -1
  177. data/lib/principles/views/problem_facts.rb +5 -3
  178. data/lib/principles/views/problem_lines.rb +32 -6
  179. data/lib/principles/views/problem_result.rb +7 -15
  180. data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +6 -6
  181. data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +9 -8
  182. data/lib/principles/views/prompts/assess-every-member/read-a-flagged-member-s-text-whole.md +3 -0
  183. data/lib/principles/views/prompts/assess-every-member/read-a-judged-member-s-text-whole.md +3 -0
  184. data/lib/principles/views/prompts/assess-every-member/turn-on-request-logging-to-see-what-reaches-context.md +2 -0
  185. data/lib/principles/views/prompts/assess-every-member/weigh-what-reached-the-context.md +7 -0
  186. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
  187. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +5 -0
  188. data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +1 -1
  189. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-configuration.md +41 -0
  190. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-scripts.md +35 -0
  191. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-instruction-files.md +37 -0
  192. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-other-text-an-agent-reads.md +38 -0
  193. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-rule-files.md +34 -0
  194. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-skills.md +35 -0
  195. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-subagent-definitions.md +35 -0
  196. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +50 -51
  197. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +2 -1
  198. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +1 -1
  199. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +32 -32
  200. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
  201. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +7 -6
  202. data/lib/principles/views/prompts/learn-what-a-command-does/remove-logged-requests.md +16 -0
  203. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +2 -1
  204. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +2 -2
  205. data/lib/principles/views/prompts/learn-what-a-command-does/show-audit.md +7 -0
  206. data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +8 -2
  207. data/lib/principles/views/prompts/learn-what-a-command-does/show-carrier-practices.md +13 -0
  208. data/lib/principles/views/prompts/learn-what-a-command-does/show-logged-requests.md +20 -0
  209. data/lib/principles/views/prompts/learn-what-a-command-does/show-members-in-logged-requests.md +48 -0
  210. data/lib/principles/views/prompts/learn-what-a-command-does/show-principle.md +14 -14
  211. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +27 -27
  212. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +10 -10
  213. data/lib/principles/views/prompts/learn-what-a-command-does/turn-off-request-logging.md +10 -0
  214. data/lib/principles/views/prompts/learn-what-a-command-does/turn-on-request-logging.md +32 -0
  215. data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +3 -2
  216. data/lib/principles/views/prompts/read-what-reached-the-context/explain-request-logging-to-the-user.md +11 -0
  217. data/lib/principles/views/prompts/read-what-reached-the-context/see-whether-members-reach-the-agent.md +2 -0
  218. data/lib/principles/views/prompts/read-what-reached-the-context/what-absent-means.md +2 -0
  219. data/lib/principles/views/prompts/read-what-reached-the-context/what-not-a-carrier-means.md +2 -0
  220. data/lib/principles/views/prompts/read-what-reached-the-context/what-present-but-not-loaded-means.md +2 -0
  221. data/lib/principles/views/prompts/read-what-reached-the-context/what-present-means.md +1 -0
  222. data/lib/principles/views/prompts/read-what-reached-the-context/what-unmeasurable-means.md +2 -0
  223. data/lib/principles/views/prompts/report-after-a-commit/plugin-members-are-still-listed.md +1 -0
  224. data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members-waiting-on-an-upgrade.md +2 -2
  225. data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members.md +2 -2
  226. data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-what-each-needs-before-the-next-commit.md +1 -0
  227. data/lib/principles/views/prompts/set-principles-up/entry-file-passage.md +1 -1
  228. data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +2 -1
  229. data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +2 -3
  230. data/lib/principles/views/prompts/start-a-session/raise-the-open-findings-waiting-on-no-one.md +1 -0
  231. data/lib/principles/views/request_logging_result.rb +62 -0
  232. data/lib/principles/views/request_part.rb +10 -4
  233. data/lib/principles/views/request_parts.rb +9 -0
  234. data/lib/principles/views/whole_file_elsewhere.rb +30 -0
  235. metadata +101 -4
  236. data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +0 -1
  237. data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-each-one.md +0 -1
@@ -22,18 +22,18 @@ text is not judged. An evidence/`recorded_at` location refusal (such as `ambiguo
22
22
  (`invalid_check_result`) retains its code, any `path` and repair, names whose evidence/check failed, and gives `fields`
23
23
  with each `problem` and JSON `pointer` into your answer. `invalid_answer` names fields ending in another template's
24
24
  placeholder; use this template or reword the ending. Set correction `action` to fixed, deferred, accepted or disagreed;
25
- else `invalid_disposition` names the finding. A deferred disposition may give `waits_on`, one line naming whom it waits
26
- on and to decide what, printed by `list-open-findings`. Null is allowed on any action; text on another action or
27
- multiple lines causes `invalid_disposition`. The tool records when it was asked; never send that time. For a legacy
25
+ only a deferral may give `waits_on` text, one line naming whom it waits on to decide what, which `list-open-findings`
26
+ prints; null is allowed on any action. Never send when it was asked. A partial fix may give `unfixed_part`: the rest,
27
+ raised as a new finding. Else `invalid_disposition` names the finding. For a legacy
28
28
  prior finding, `still_holds` may supply `first_raised_at` (that audit's `audited_at`) and `raised_in` (full commit sha)
29
29
  together. Only that commit's `.principles/audits/ID.json` or earlier `.memeplex/audits/ID.json` is read; it must leave
30
30
  the same finding deferred/accepted. Judge identity yourself. Refusals explain repairs: `raised_in_not_found` (also
31
31
  outside git), `raised_in_unreadable`, `raised_in_lacks_finding`, `raised_in_time_differs`, `first_raised_not_earlier`
32
- (date must precede stored time). Completed full audits list own/kept deferred or accepted IDs in `open_findings`,
33
- fixed/resolved IDs in `resolved_findings`, and each closed prior finding's decision/reason in `prior_findings_closed`.
34
- Disagreed/withdrawn findings are in neither open nor resolved. In git, `commits_since_base` lists commits touching each
35
- member's file; uncommitted fixes have an empty list. `files_to_commit` lists their files; `commit_with` commits only
36
- those, stopping during an unfinished merge. Replace its `-m` default as `commit_message_to_replace` says.
32
+ (date must precede stored time). Completed full audits list own/kept IDs in `deferred_findings` and
33
+ `accepted_findings`, fixed/resolved IDs in `resolved_findings`, each closed prior finding's decision/reason in
34
+ `prior_findings_closed`, and none disagreed/withdrawn. In git, `commits_since_base` lists commits touching each member's
35
+ file; uncommitted fixes have an empty list. `files_to_commit` lists their files; `commit_with` commits only those,
36
+ stopping during an unfinished merge. Replace its `-m` default as `commit_message_to_replace` says.
37
37
  `cited_files_missing` lists missing cited files excluded from `files_to_commit`; record references remain. If HEAD moved
38
38
  without touching a member, `head_moved_past_base` gives `base_commit` and `head`. If its fixes changed a file another
39
39
  principle also maps, `other_principles_with_changed_members` names each such principle and its members in fixed
@@ -46,8 +46,8 @@ what to retain; `show-answer-check --help` covers `carried_assessments_citing_de
46
46
 
47
47
  In git, this tool reads the map at the audit base: fixed dispositions declare roles/checks in `changed_map_entries`,
48
48
  text/additions in `changed_members`, removals in `removed_members`. `invalid_removed_members` rejects invalid removal
49
- claims; `empty_correction_map` requires a survivor/replacement. Source files stay intact.
50
- `claimed_change_missing` rejects unchanged entries; `members_added_awaiting_assessment` lack baselines.
49
+ claims; `empty_correction_map` requires a survivor/replacement. Source files stay intact. `claimed_change_missing`
50
+ rejects unchanged entries, `plugin_member_read_only` plugin members; `members_added_awaiting_assessment` lack baselines.
51
51
  Role/removal claims require git (`map_entries_need_git`). Full rules: correction question, `show-answer-check --help`.
52
52
 
53
53
  For a `start-audit --member` request, `quote_not_found` refuses an `old_line` or `new_line` not a line only its side
@@ -0,0 +1,10 @@
1
+ Use it when you are done capturing the requests the host sends, so later sessions stop filling
2
+ `.principles/request-logging/requests/` with copies of their whole context.
3
+
4
+ It empties the `env` of `.principles/request-logging/settings.json`, the launch file, and lists it under
5
+ `wrote`, so a host started with that file captures nothing. Where request logging was never turned on it writes nothing.
6
+ It deletes no logged request: those already captured stay in the folder, which git ignores. A host already running keeps
7
+ capturing until it is relaunched, which `next_action` says.
8
+
9
+ Before writing, it refuses with `request_logging_unguarded` while the folder exists without its `.gitignore`, and
10
+ with `request_logging_not_ignored` while git does not ignore every file there.
@@ -0,0 +1,32 @@
1
+ Use it before you capture the requests the host sends, to see which mapped members' text reaches the agent's
2
+ context. The project's first full audit to complete names it in `submit-answer`'s `next_action`, for the agent
3
+ to offer the user, while no request is logged here. A request holds the session's whole working context, the files
4
+ read and every tool result, so it must never be committed: this command sets up a folder git ignores before anything
5
+ is written there.
6
+
7
+ It writes `.principles/request-logging/.gitignore`, holding `*`, unless it is there, so git ignores the folder and
8
+ all it holds, and lists it under `wrote`. Then it asks git whether it ignores the folder's files and every file
9
+ already in it. Outside git, or when git tracks a file there, it refuses with `request_logging_not_ignored` and
10
+ removes what it wrote; its repair says how to make git ignore the folder.
11
+
12
+ Once git confirms it, it writes `.principles/request-logging/settings.json`, the launch file, and lists it
13
+ under `wrote`. Its `env` turns Claude Code's telemetry on with its metrics, logs and traces exporters set to `none`,
14
+ and asks the host to write each request's body under the folder's `requests/`, by its absolute path. Claude Code
15
+ documents reading these variables at launch, from a file passed with `claude --settings`, and ignoring them in a
16
+ project's own settings. A real launch wrote the bodies with the exporters off, read from `--settings` as from
17
+ variables exported in the shell. A logged request holds the user's account email as well as the working context. The
18
+ host writes each file readable by other local users; this command makes the folder, when it is new, readable only by
19
+ its owner.
20
+
21
+ It prints `launch_line`, `claude --settings` and the launch file's path, for the user to start Claude Code with.
22
+ Capture starts only on that launch, so the host must be relaunched with it. It is a line, never an alias, since an
23
+ alias would capture in every project the user starts the host in; each checkout or worktree writes its own launch
24
+ file. `resume_line` is the same line with `--resume`, to keep the conversation. The line starts the host from a
25
+ shell; a host the Desktop app or an IDE starts is not given the file. `next_action` says what a logged request
26
+ holds, that the launch file overrides a telemetry exporter the user set up, for that launch, and that
27
+ `turn-off-request-logging` deletes no logged request. Git ignores the folder, but a backup or an archive of the
28
+ project still holds it.
29
+
30
+ `explain_to_user` is a paragraph for the agent to give the user before the relaunch: what a logged request holds and
31
+ who can read it, that subagents' and side calls' requests are logged too, its disk use, `remove-logged-requests` and
32
+ `turn-off-request-logging`, and that `--resume` keeps the conversation while any relaunch stops background agents.
@@ -1,5 +1,6 @@
1
- Use these requested Markdown outlines to continue the survey; decide which files and rules matter to the task.
2
- Non-Markdown files show their path and size alone, not their contents; open one only if needed.
1
+ Use these requested outlines to continue the survey; decide which files and rules matter to the task.
2
+ Other text, such as a script, is outlined by its whole-line `#` comments and a CI workflow by its jobs and steps; a
3
+ file with neither shows its path and size; open one only if needed.
3
4
  Each inventory.unreadable entry gives the failed path and its repair; ignored files remain unread.
4
5
  The whole result is budgeted. inventory.outlines_cut names files with shortened list items; their
5
6
  `(N more, lines A-B)` entries give the lines to read if needed. inventory.outlines_left_out names files whose
@@ -0,0 +1,11 @@
1
+ Request logging keeps a copy of every request Claude Code sends to the model, under
2
+ `.principles/request-logging/requests/`, so `principles` can show which of your principles' text actually reached
3
+ the agent. Each logged request holds your account email and the session's whole working context: the conversation,
4
+ the files read and every tool result. Requests for subagents and the host's side calls are logged too. The host
5
+ writes each file readable by every user on this machine; this command makes the folder, when it is new, readable
6
+ only by you, which keeps them from other users while it stays so. Each request is a whole copy of the context, so a
7
+ long session's logs reach hundreds of megabytes: `remove-logged-requests` deletes all but the newest five sessions',
8
+ and `turn-off-request-logging` empties the launch file, so a launch with it logs nothing. Capture starts only once
9
+ Claude Code is relaunched with the printed `launch_line`, or with `resume_line`, which adds `--resume` to keep this
10
+ conversation; any relaunch stops the background agents running now, and for that launch, the file sets every
11
+ telemetry exporter you set up to none.
@@ -0,0 +1,2 @@
1
+ To see whether this principle's members reach the agent at all, and what they cost there, offer the user request
2
+ logging, saying first what its result's `explain_to_user` says: %{command}
@@ -0,0 +1,2 @@
1
+ No request held its lines, though a host loads its file, so it did not reach the agent in these requests; trust
2
+ this only while the scan read every request through.
@@ -0,0 +1,2 @@
1
+ No request held its lines, and no host loads its file by itself, as with a spec or a script, so its absence is
2
+ expected rather than a gap.
@@ -0,0 +1,2 @@
1
+ Its lines were seen only inside a tool the host lists with deferred loading, whose description the model reads only
2
+ once a tool search loads it.
@@ -0,0 +1 @@
1
+ A request held at least one of its lines where the model reads it.
@@ -0,0 +1,2 @@
1
+ None of its lines is 24 bytes or more, too short to tell apart from common text, so the scan cannot say whether
2
+ it arrived.
@@ -0,0 +1 @@
1
+ %{count} %{members} still listed from an installed plugin, which no commit changes.
@@ -1,2 +1,2 @@
1
- principles: the commits this Bash call brought in changed these mapped members, whose audits wait on an upgrade,
2
- so this copy cannot audit them:
1
+ principles: these mapped members changed since their last record, and their audits wait on an upgrade, so
2
+ this copy cannot audit them:
@@ -1,2 +1,2 @@
1
- principles: the commits this Bash call brought in changed these mapped members, one per line with its
2
- principle, id, newest changing commit, that commit's subject and what it was compared with:
1
+ principles: these mapped members changed since their last record, one per line with its principle, id,
2
+ newest changing commit, that commit's subject and what it was compared with:
@@ -0,0 +1 @@
1
+ This command shows what each needs before your next commit: %{command}
@@ -1,3 +1,3 @@
1
1
  ## %{heading}
2
2
 
3
- Where `principles` is installed, run `principles list-member-problems --short` at each session start, after a compaction and after each commit that edits a mapped file, and act on what it reports.
3
+ Where `principles` is installed without its hooks, run `principles list-member-problems --short` at session start, after a compaction and after each commit to a mapped file, and act on what it reports.
@@ -1 +1,2 @@
1
- %{facts} %{raise} in your %{reply} reply; nothing else will.%{command}
1
+ Act on each finding that waits on you. In your %{reply} reply, raise each that waits on %{whom}; nothing else will.
2
+ %{facts} All: %{command}
@@ -1,3 +1,2 @@
1
- %{counted} no full audit. Unless your instructions or memory say to skip %{them}, tell the user and start
2
- one background subagent to follow what this prints, not yourself; at your next pause relay its result, or offer the
3
- audit if you could not: %{command}
1
+ %{counted} no full audit. Start one background subagent to follow what this command prints, tell the user, and relay
2
+ its result when it ends: %{command}
@@ -0,0 +1 @@
1
+ In your %{reply} reply, raise each finding that waits on no one; nothing else will. %{facts} All: %{command}
@@ -0,0 +1,62 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "time"
5
+ require_relative "invocation"
6
+ require_relative "prompts"
7
+ require_relative "shell_word"
8
+
9
+ module Principles
10
+ # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
11
+ module Views
12
+ # What turning request logging on or off did.
13
+ class RequestLoggingResult
14
+ RELAUNCH = "A host started with the launch file keeps capturing until you relaunch it; the logged requests " \
15
+ "already captured stay in .principles/request-logging/requests/, which git ignores."
16
+ NEVER_ON = "Request logging was never turned on here, so there is nothing to stop."
17
+
18
+ #: (Invocation) -> void
19
+ def initialize(invocation)
20
+ @invocation = invocation
21
+ freeze
22
+ end
23
+
24
+ # launch_line starts the host with the launch file for that launch only: a printed line, never an alias, since
25
+ # an alias would capture in every project the user starts the host in; resume_line is the same line resuming a
26
+ # conversation, since a fresh launch starts a new one. explain_to_user is what the agent tells
27
+ # the user before that relaunch: what is logged, who can read it, its cost and how to stop it.
28
+ #: (wrote: Array[String], launch_file: String) -> Hash[String, untyped]
29
+ def turned_on(wrote:, launch_file:)
30
+ launch = "claude --settings #{ShellWord.new(launch_file)}"
31
+ { "status" => "request_logging_on", "wrote" => wrote, "launch_line" => launch,
32
+ "resume_line" => "#{launch} --resume",
33
+ "explain_to_user" => Prompts.text("read-what-reached-the-context/explain-request-logging-to-the-user"),
34
+ "next_action" => "Give the user launch_line to start Claude Code with; capture starts only on that " \
35
+ "launch, so relaunch the host with it. Each logged request holds the session's whole " \
36
+ "working context, the files read and every tool result, in a folder git ignores. The " \
37
+ "launch file sets every telemetry exporter to none for that launch, overriding an " \
38
+ "exporter the user set up. Turning request logging off deletes no logged request: " \
39
+ "#{@invocation.in_project("turn-off-request-logging")}" }
40
+ end
41
+
42
+ # newest names facts for the agent to judge whether capture is running; it never says a session is capturing.
43
+ #: (sessions: Array[Hash[String, untyped]], orphan_requests: Hash[String, Integer],
44
+ #| newest_request_written_at: Time?, newest_session_id: String?) -> Hash[String, untyped]
45
+ def shown(sessions:, orphan_requests:, newest_request_written_at:, newest_session_id:)
46
+ { "status" => "logged_requests_shown", "sessions" => sessions, "orphan_requests" => orphan_requests,
47
+ "newest" => { "request_written_at" => newest_request_written_at&.utc&.iso8601,
48
+ "session_id" => newest_session_id },
49
+ "wrote" => [] }
50
+ end
51
+
52
+ #: (removed: Array[String]) -> Hash[String, untyped]
53
+ def removed(removed:) = { "status" => "logged_requests_removed", "removed" => removed, "wrote" => [] }
54
+
55
+ #: (wrote: Array[String]) -> Hash[String, untyped]
56
+ def turned_off(wrote:)
57
+ { "status" => "request_logging_off", "wrote" => wrote,
58
+ "next_action" => wrote.empty? ? NEVER_ON : RELAUNCH }
59
+ end
60
+ end
61
+ end
62
+ end
@@ -19,14 +19,16 @@ module Principles
19
19
 
20
20
  # listed is what the agent reads of this part before its instructions. help is, by slot, the placeholder text
21
21
  # each of its entries carries in the answer printed alone, where no instruction is printed beside it to say
22
- # what each field takes.
22
+ # what each field takes. alone is, by slot, its entries as the answer printed alone gives them before their
23
+ # help, where they show what the list beside the request's answer would.
23
24
  #: (shown: Hash[String, untyped], slots: Hash[String, untyped], ?instructions: Array[Instruction],
24
- #| ?help: Hash[String, Hash[String, untyped]]) -> void
25
- def initialize(shown:, slots:, instructions: [], help: {})
25
+ #| ?help: Hash[String, Hash[String, untyped]], ?alone: Hash[String, untyped]) -> void
26
+ def initialize(shown:, slots:, instructions: [], help: {}, alone: {})
26
27
  @listed = shown
27
28
  @slots = slots
28
29
  @instructions = instructions
29
30
  @help = help
31
+ @alone = alone
30
32
  freeze
31
33
  end
32
34
 
@@ -34,11 +36,15 @@ module Principles
34
36
  #: () -> Hash[String, untyped]
35
37
  def shown = @instructions.reduce(@listed) { |all, instruction| all.merge(instruction.printed) }
36
38
 
39
+ # Why the index gives no bytes for this part, when this read left it unfilled; nil, as here, when it is filled.
40
+ #: () -> String?
41
+ def bytes_unknown = nil
42
+
37
43
  # The slots, each entry with its help in place of the fields the agent fills.
38
44
  #: () -> Hash[String, untyped]
39
45
  def slots_to_fill
40
46
  @slots.to_h do |name, entries|
41
- [name, entries.map { |entry| entry.merge(@help.fetch(name, {})) }]
47
+ [name, @alone.fetch(name, entries).map { |entry| entry.merge(@help.fetch(name, {})) }]
42
48
  end
43
49
  end
44
50
  end
@@ -22,6 +22,15 @@ module Principles
22
22
  #: () -> Array[Instruction]
23
23
  def instructions = @parts.flat_map(&:instructions)
24
24
 
25
+ # Why the index gives no bytes, by the name of each part this read left unfilled.
26
+ #: () -> Hash[String, String]
27
+ def bytes_unknown
28
+ @parts.each_with_object({}) do |part, unknown|
29
+ reason = part.bytes_unknown or next
30
+ part.shown.each_key { unknown[it] = reason }
31
+ end
32
+ end
33
+
25
34
  # template, with each part's slots added after its own entries, in order.
26
35
  #: (Hash[String, untyped]) -> Hash[String, untyped]
27
36
  def slotted_after(template) = @parts.reduce(template) { |all, part| all.merge(part.slots) }
@@ -0,0 +1,30 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Principles
5
+ module Views
6
+ # The other maps holding a new whole-file member's file whole, which ask the agent AddedMember's scope-or-join
7
+ # question.
8
+ class WholeFileElsewhere
9
+ #: (?Array[String]) -> void
10
+ def initialize(principle_ids = [])
11
+ @principle_ids = principle_ids
12
+ freeze
13
+ end
14
+
15
+ #: () -> Hash[String, untyped]
16
+ def to_h = @principle_ids.empty? ? {} : { "whole_file_elsewhere" => @principle_ids }
17
+
18
+ #: () -> String
19
+ def note
20
+ return "" if @principle_ids.empty?
21
+
22
+ "Other principles hold this whole file too (whole_file_elsewhere), so every edit to it is a change to each. "
23
+ end
24
+
25
+ # Whether it asks AddedMember's scope-or-join question: when other principles hold the file whole.
26
+ #: () -> bool
27
+ def asks_scope_or_join? = @principle_ids.any?
28
+ end
29
+ end
30
+ end