principles 0.0.10 → 0.1.0

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 (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/README.md +0 -2
  4. data/lib/principles/controllers/acknowledgement.rb +11 -4
  5. data/lib/principles/controllers/acknowledgements.rb +4 -4
  6. data/lib/principles/controllers/answer.rb +2 -2
  7. data/lib/principles/controllers/assessment.rb +20 -4
  8. data/lib/principles/controllers/audit.rb +16 -5
  9. data/lib/principles/controllers/broken_member_repairs.rb +60 -0
  10. data/lib/principles/controllers/command.rb +8 -30
  11. data/lib/principles/controllers/correction.rb +7 -5
  12. data/lib/principles/controllers/full_audit_request.rb +44 -22
  13. data/lib/principles/controllers/guidance_search_paths.rb +1 -1
  14. data/lib/principles/controllers/inventory.rb +3 -3
  15. data/lib/principles/controllers/member_acknowledgement.rb +5 -5
  16. data/lib/principles/controllers/member_addition.rb +5 -2
  17. data/lib/principles/controllers/member_entries.rb +1 -1
  18. data/lib/principles/controllers/member_problems_report.rb +11 -7
  19. data/lib/principles/controllers/members_to_assess.rb +1 -1
  20. data/lib/principles/controllers/meta_principle_setup.rb +4 -3
  21. data/lib/principles/controllers/open_correction.rb +3 -3
  22. data/lib/principles/controllers/open_finding_decisions.rb +66 -0
  23. data/lib/principles/controllers/running_tool.rb +22 -5
  24. data/lib/principles/controllers/survey.rb +3 -2
  25. data/lib/principles/data/candidate_files_found.rb +6 -4
  26. data/lib/principles/data/command-steps.json +20 -20
  27. data/lib/principles/data/json_text.rb +5 -1
  28. data/lib/principles/data/parser_message.rb +61 -0
  29. data/lib/principles/data/project_files.rb +4 -2
  30. data/lib/principles/data/repository.rb +4 -4
  31. data/lib/principles/data/running_version.rb +1 -1
  32. data/lib/principles/data/schemas/audit-record.schema.json +15 -0
  33. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  34. data/lib/principles/data/schemas/{repointing-answer.schema.json → deciding-answer.schema.json} +12 -6
  35. data/lib/principles/invocation_options.rb +4 -4
  36. data/lib/principles/launch.rb +5 -3
  37. data/lib/principles/models/acknowledgement.rb +1 -27
  38. data/lib/principles/models/acknowledgement_left_as_printed.rb +2 -1
  39. data/lib/principles/models/acknowledgement_placeholders.rb +48 -0
  40. data/lib/principles/models/after_commit_input.rb +1 -0
  41. data/lib/principles/models/assessment_answer.rb +2 -2
  42. data/lib/principles/models/assessment_basis.rb +1 -1
  43. data/lib/principles/models/assessment_left_as_printed.rb +1 -1
  44. data/lib/principles/models/audit.rb +24 -4
  45. data/lib/principles/models/audit_entry_protecting_map.rb +1 -0
  46. data/lib/principles/models/audit_record.rb +5 -14
  47. data/lib/principles/models/audit_records.rb +2 -2
  48. data/lib/principles/models/audited_member_lines.rb +1 -1
  49. data/lib/principles/models/candidate_files.rb +1 -1
  50. data/lib/principles/models/candidate_inventory.rb +20 -10
  51. data/lib/principles/models/candidate_outline.rb +1 -1
  52. data/lib/principles/models/changed_regions.rb +1 -1
  53. data/lib/principles/models/command_steps.rb +1 -2
  54. data/lib/principles/models/correction_basis.rb +1 -1
  55. data/lib/principles/models/declared_map_changes.rb +1 -2
  56. data/lib/principles/models/disposition.rb +12 -76
  57. data/lib/principles/models/disposition_placeholders.rb +48 -0
  58. data/lib/principles/models/disposition_text_field.rb +41 -0
  59. data/lib/principles/models/evidence_item.rb +1 -1
  60. data/lib/principles/models/finding_decision.rb +84 -0
  61. data/lib/principles/models/finding_write_ups.rb +2 -1
  62. data/lib/principles/models/first_full_audit.rb +1 -0
  63. data/lib/principles/models/fix_only_fields.rb +4 -3
  64. data/lib/principles/models/frontmatter_fields.rb +1 -1
  65. data/lib/principles/models/guidance_search_path.rb +1 -1
  66. data/lib/principles/models/guidance_search_paths.rb +5 -1
  67. data/lib/principles/models/head_moves.rb +1 -0
  68. data/lib/principles/models/ignored_candidates.rb +1 -1
  69. data/lib/principles/models/instruction_named.rb +1 -1
  70. data/lib/principles/models/json_path_query.rb +1 -1
  71. data/lib/principles/models/json_path_selectors.rb +1 -1
  72. data/lib/principles/models/json_path_string.rb +1 -1
  73. data/lib/principles/models/last_completed_revision.rb +1 -1
  74. data/lib/principles/models/line_diff.rb +1 -1
  75. data/lib/principles/models/line_span.rb +1 -1
  76. data/lib/principles/models/loading_scope.rb +1 -0
  77. data/lib/principles/models/located_text.rb +20 -12
  78. data/lib/principles/models/map_change.rb +66 -0
  79. data/lib/principles/models/mapped_principles.rb +4 -0
  80. data/lib/principles/models/markdown_file.rb +22 -1
  81. data/lib/principles/models/member.rb +1 -1
  82. data/lib/principles/models/member_assessments.rb +11 -4
  83. data/lib/principles/models/member_elsewhere.rb +1 -1
  84. data/lib/principles/models/member_file.rb +15 -13
  85. data/lib/principles/models/member_hashes_as_written.rb +2 -2
  86. data/lib/principles/models/member_history.rb +1 -1
  87. data/lib/principles/models/member_lines.rb +1 -1
  88. data/lib/principles/models/member_loading_scopes.rb +1 -0
  89. data/lib/principles/models/member_mapping_run.rb +4 -4
  90. data/lib/principles/models/member_moves.rb +1 -2
  91. data/lib/principles/models/member_problems.rb +5 -1
  92. data/lib/principles/models/member_region.rb +1 -1
  93. data/lib/principles/models/member_repair_moves.rb +20 -4
  94. data/lib/principles/models/member_snapshots.rb +10 -10
  95. data/lib/principles/models/members_elsewhere.rb +1 -1
  96. data/lib/principles/models/members_in_consecutive_sections.rb +1 -0
  97. data/lib/principles/models/members_sharing_lines.rb +2 -2
  98. data/lib/principles/models/misspelt_member_id.rb +10 -4
  99. data/lib/principles/models/named_placeholder.rb +32 -0
  100. data/lib/principles/models/open_finding.rb +4 -3
  101. data/lib/principles/models/open_findings_decision.rb +124 -0
  102. data/lib/principles/models/open_findings_elsewhere.rb +1 -1
  103. data/lib/principles/models/other_templates_placeholders.rb +26 -6
  104. data/lib/principles/models/outline_budget.rb +1 -1
  105. data/lib/principles/models/outline_group.rb +1 -1
  106. data/lib/principles/models/outline_section.rb +1 -1
  107. data/lib/principles/models/part_named.rb +1 -1
  108. data/lib/principles/models/plain_text_file.rb +1 -1
  109. data/lib/principles/models/principle_history.rb +5 -4
  110. data/lib/principles/models/principle_members.rb +1 -1
  111. data/lib/principles/models/problem_report.rb +13 -1
  112. data/lib/principles/models/project.rb +15 -16
  113. data/lib/principles/models/project_at_commit.rb +60 -0
  114. data/lib/principles/models/project_history.rb +10 -52
  115. data/lib/principles/models/prose_line.rb +36 -0
  116. data/lib/principles/models/record_format.rb +17 -4
  117. data/lib/principles/models/recorded_finding.rb +47 -7
  118. data/lib/principles/models/recorded_findings.rb +7 -7
  119. data/lib/principles/models/recorded_hashes.rb +1 -1
  120. data/lib/principles/models/recorded_members.rb +6 -8
  121. data/lib/principles/models/report_hooks.rb +1 -0
  122. data/lib/principles/models/request_id.rb +2 -2
  123. data/lib/principles/models/sent_answer.rb +5 -3
  124. data/lib/principles/models/session_start_input.rb +1 -0
  125. data/lib/principles/models/stale_request.rb +22 -8
  126. data/lib/principles/models/submitted_answer.rb +1 -1
  127. data/lib/principles/models/survey_search_paths.rb +13 -5
  128. data/lib/principles/models/template_placeholders.rb +22 -7
  129. data/lib/principles/models/text_size.rb +11 -3
  130. data/lib/principles/models/text_within.rb +1 -1
  131. data/lib/principles/models/unchecked_members.rb +1 -0
  132. data/lib/principles/models/uncommitted_outside_the_map.rb +1 -1
  133. data/lib/principles/models/unfinished_field.rb +34 -0
  134. data/lib/principles/models/unknown_principle.rb +1 -0
  135. data/lib/principles/models/write_up_opening.rb +5 -31
  136. data/lib/principles/models/write_up_pointer.rb +2 -1
  137. data/lib/principles/start_audit_options.rb +35 -20
  138. data/lib/principles/version.rb +2 -2
  139. data/lib/principles/views/acknowledged_result.rb +59 -0
  140. data/lib/principles/views/acknowledgement_result.rb +44 -51
  141. data/lib/principles/views/added_member.rb +10 -1
  142. data/lib/principles/views/answer_in_a_file.rb +65 -0
  143. data/lib/principles/views/assessed_members.rb +4 -2
  144. data/lib/principles/views/assessment_answer_guide.rb +59 -0
  145. data/lib/principles/views/assessment_request.rb +2 -26
  146. data/lib/principles/views/audit_result.rb +18 -7
  147. data/lib/principles/views/candidate_files_result.rb +9 -4
  148. data/lib/principles/views/context_parts.rb +41 -10
  149. data/lib/principles/views/correction_request.rb +27 -18
  150. data/lib/principles/views/first_audit_brief.rb +2 -1
  151. data/lib/principles/views/guidance_search_paths_result.rb +13 -6
  152. data/lib/principles/views/invocation.rb +14 -4
  153. data/lib/principles/views/json_on_one_line.rb +18 -0
  154. data/lib/principles/views/member_repairs.rb +21 -5
  155. data/lib/principles/views/meta_principle_result.rb +26 -5
  156. data/lib/principles/views/open_findings_decision_result.rb +60 -0
  157. data/lib/principles/views/parts_index_result.rb +8 -6
  158. data/lib/principles/views/principle_read_result.rb +2 -2
  159. data/lib/principles/views/problem_facts.rb +46 -0
  160. data/lib/principles/views/problem_lines.rb +8 -3
  161. data/lib/principles/views/problem_result.rb +53 -31
  162. data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +6 -0
  163. data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +2 -1
  164. data/lib/principles/views/prompts/decide-open-findings/give-only-what-changed-of-each.md +6 -0
  165. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
  166. data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -1
  167. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +2 -2
  168. data/lib/principles/views/prompts/find-a-principle-to-map/where-a-survey-with-only-looks.md +4 -0
  169. data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +2 -1
  170. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +1 -0
  171. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-check.md +4 -3
  172. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +4 -3
  173. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +12 -12
  174. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +7 -8
  175. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +11 -12
  176. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +4 -3
  177. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member-check.md +4 -3
  178. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +4 -3
  179. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +13 -12
  180. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +2 -2
  181. data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +2 -2
  182. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +12 -12
  183. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
  184. data/lib/principles/views/prompts/start-a-session/act-on-the-changed-principles.md +2 -0
  185. data/lib/principles/views/prompts.rb +7 -4
  186. metadata +26 -8
  187. data/lib/principles/controllers/repoint.rb +0 -67
  188. data/lib/principles/models/repoint.rb +0 -125
  189. data/lib/principles/models/write_up_repoint.rb +0 -38
  190. data/lib/principles/views/prompts/repoint-write-ups/point-each-moved-write-up-at-its-new-place.md +0 -10
  191. data/lib/principles/views/repoint_result.rb +0 -80
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "deferred": {
13
13
  "action": "deferred",
14
- "reason": "Why, and what remains",
14
+ "reason": "%{reason_placeholder}",
15
15
  "changed_members": [],
16
16
  "evidence": [],
17
17
  "recorded_at": { "path": "where the project keeps the write-up, or set recorded_at null if none", "starting_at": "the line that states the problem" },
@@ -1,2 +1,3 @@
1
1
  Deferred with recorded_at null: %{finding_ids}. That is allowed when there is nowhere to point; the record then
2
- keeps no write-up, so list-open-findings prints none. If one is written up, point its recorded_at there and check again.
2
+ keeps no pointer, so list-open-findings prints no write-up. If one is written up in a project file, point its
3
+ recorded_at there and check again; if it is written up outside the project, such as in an issue, give its link in its reason.
@@ -4,9 +4,9 @@ fixed finding needs an actual change to its members, evidence and a reassessment
4
4
  template gives a `reason` or a fix's `reassessment` with your own words, and do not copy an `answer_guide`
5
5
  sample into the field it illustrates, `waits_on` included; either one sent back unchanged is refused. Keep the project's
6
6
  owner-approval process; this tool edits nothing. The audit record keeps each finding's members, its
7
- `problem` as you stated it and its disposition, but not your reason. So when you write a finding up somewhere the project keeps, such as a ticket
7
+ `problem` as you stated it, its disposition and your reason, and `list-open-findings` prints the reason. So when you write a finding up somewhere the project keeps, such as a ticket
8
8
  or a notes file, set its `recorded_at` to that place, as `{"path": ..., "heading": ...}` or with
9
- `starting_at`, and the record keeps the pointer in the record. Leave it null when there is nowhere to point. `list-open-findings` prints the first non-blank line where `recorded_at` points, so open a write-up with one line saying what the finding is. Point with `starting_at` at the line that states the problem, rather than at a heading alone, since a heading is often followed by a status line or is shared by several findings.
9
+ `starting_at`, and the record keeps the pointer. When the write-up is outside the project, such as an issue or a tracker comment, leave `recorded_at` null and give its link in the `reason`. Leave it null when there is nowhere to point. `list-open-findings` prints the first non-blank line where `recorded_at` points, so open a write-up with one line saying what the finding is. Point with `starting_at` at the line that states the problem, rather than at a heading alone, since a heading is often followed by a status line or is shared by several findings.
10
10
  When a deferral waits on someone, set its `waits_on` to one line saying whom it waits on and to decide what, such as
11
11
  "<person>, to approve a CI change", and keep the reason in the write-up. Leave it null when it waits on no one in
12
12
  particular. Only a deferral may give one, and this tool records when it was asked.
@@ -0,0 +1,4 @@
1
+ Only the files the --only globs match, within the folders a survey walks: the places hosts load by convention and the
2
+ recorded guidance search paths are left out, since a survey without --only lists them. Files git ignores are named
3
+ under ignored and not listed to map. Other text files are listed by path and size, without Markdown outlines. Nothing
4
+ is executed; delivery is not observed.
@@ -7,7 +7,8 @@ Use list-candidate-files --also with a quoted project-relative file pattern to t
7
7
  Writes only `.principles/guidance-search-paths.json`, in the selected project's store; commit it as it changes.
8
8
  The glob is normalized as --also normalizes it. A duplicate addition returns `unchanged` with an empty `wrote` list
9
9
  and leaves existing bytes untouched. `recorded_guidance_search_paths` gives the normalized stored list; `next_action`
10
- prints a read-only survey; later surveys automatically include recorded locations without repeating --also.
10
+ prints a read-only survey of just the files an added glob matches, with list-candidate-files --only, since the rest
11
+ were surveyed before; later surveys automatically include recorded locations without repeating --also.
11
12
  No map, audit record or guidance file is changed, and nothing is executed.
12
13
 
13
14
  Blank, absolute or parent-traversing patterns are refused as `invalid_guidance_search_path`. Invalid JSON or schema
@@ -59,6 +59,7 @@ The location flags narrow the member; omit them for a whole file. Give both to t
59
59
  - `--section HEADING`: a Markdown heading's exact text without its # marks. The section runs to the next
60
60
  heading of the same or a higher level.
61
61
  - `--starting-at TEXT`: one literal opening; without `--ending-at TEXT`, the passage ends at its line's end.
62
+ In Markdown, `added.continues_to_line` is the last line of a paragraph or list item that runs on past it.
62
63
  A new literal ending must occur once after the complete opening in the selected region; overlapping matches count.
63
64
  `ambiguous_passage_end` refuses before writing, with exact `eligible_ending_count`, up to five `ending_candidates`
64
65
  (1-based line/character column), and `ending_candidates_omitted`. Quote more specific closing text.
@@ -12,6 +12,7 @@ Run during a full audit, between an accepted assessment and its correction, to f
12
12
  in the `changed_map_entries` of the fixed disposition it fixes, and submit the correction. This tool prints both
13
13
  that step and starting the audit, since it cannot tell in git whether a correction is open.
14
14
 
15
- An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing,
16
- dashes or quotes, the refusal names that id under `did_you_mean` and starts its repair with this command run on it
17
- instead. This tool never acts on the near miss: check that it is the member you meant before you run it.
15
+ An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing, dashes
16
+ or quotes, or is the heading or passage of exactly one mapped id given without its path, the refusal names that id under
17
+ `did_you_mean` and starts its repair with this command run on it instead. This tool never acts on the near miss: check
18
+ that it is the member you meant before you run it.
@@ -4,6 +4,7 @@ Run during a full audit, between an accepted assessment and its correction, to f
4
4
  in the `changed_map_entries` of the fixed disposition it fixes, and submit the correction. This tool prints both
5
5
  that step and starting the audit, since it cannot tell in git whether a correction is open.
6
6
 
7
- An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing,
8
- dashes or quotes, the refusal names that id under `did_you_mean` and starts its repair with this command run on it
9
- instead. This tool never acts on the near miss: check that it is the member you meant before you run it.
7
+ An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing, dashes
8
+ or quotes, or is the heading or passage of exactly one mapped id given without its path, the refusal names that id under
9
+ `did_you_mean` and starts its repair with this command run on it instead. This tool never acts on the near miss: check
10
+ that it is the member you meant before you run it.
@@ -11,9 +11,11 @@ To include other guidance now, repeat `--also GLOB`, quoting each root-relative
11
11
  %{executable} list-candidate-files --also 'guides/**/*.md' --also 'docs/agents/*.md'
12
12
 
13
13
  Recorded globs in `.principles/guidance-search-paths.json` are reused automatically; `recorded_guidance_search_paths`
14
- lists them when nonempty. `--also` adds temporary selections; `additional_search_paths` counts each normalized glob once
15
- across both sources. Missing configuration is empty and creates nothing. Unusable configuration is refused rather
16
- than silently omitted; see add-guidance-search-path's repairs. After the table, ask where else guidance lives.
14
+ lists them when nonempty. Repeated `--only GLOB` lists just the files its globs match, leaving out the places hosts
15
+ load by convention and the recorded globs, so a survey after recording a search path reads only what it adds.
16
+ `--also` adds temporary selections; `additional_search_paths` counts each normalized glob once across both sources.
17
+ Missing configuration is empty and creates nothing. Unusable configuration is refused rather than silently omitted;
18
+ see add-guidance-search-path's repairs. After the table, ask where else guidance lives.
17
19
  Globs match case-sensitively: `*` stays in one path segment, `**/` includes deeper folders, braces select alternatives,
18
20
  and dotfiles are included. A leading `./` is normalized. Blank or absolute globs, parent segments and NUL are refused
19
21
  as `invalid_guidance_search_path`. The inventory still skips internal stores, installed-package folders and nested Git
@@ -35,13 +37,12 @@ left out, as an entry file's is not; when they alone pass the budget, `range_out
35
37
  the question asks you to name a later REV or choose which to survey. `uncommitted` names each Markdown file that differs from HEAD or is untracked,
36
38
  since no commit in the range holds it yet: survey it yourself if the change includes it. Outside git it refuses with
37
39
  `range_needs_git`, and a REV git resolves to no commit refuses with `unknown_revision`, naming it under `revision`.
38
- Each listed Markdown file, except those under `possibly_test_data`, gives its `outline`: its headings in order, as
39
- Markdown, outside code fences, and under each its top-level list items, an item by its bold lead or its first 60
40
- characters, at most 20 a heading. One with frontmatter gives its `description` too, and leaves the frontmatter
41
- out of its outline. `opening_line` is the file's first prose paragraph, its hard-wrapped lines joined, outside
42
- headings, lists, tables and code, ending at its last sentence end within 160 characters, or else cut on a word. Read
43
- the outlines for the survey rather than the files, so you need no script to take headings out of them. The question
44
- then asks you to name, under the table, the files that look ticket-local or boilerplate.
40
+ Each listed Markdown file, except those under `possibly_test_data`, gives its `outline`. `outline` is a flat list of
41
+ strings, one per line, in the file's order, with no keys: each heading outside code fences as Markdown, `## Name`,
42
+ then its top-level list items, `- item`, each by its bold lead or first 60 characters, at most 20 a heading. One
43
+ with frontmatter gives its `description` too, and leaves the frontmatter out of its outline. `opening_line` is the
44
+ file's first prose paragraph, its lines joined, outside headings, lists, tables and code, ending at its last sentence
45
+ end within 160 characters, or else cut on a word. Read the outlines rather than the files; no script is needed.
45
46
  The result keeps to a byte budget under Claude Code's inline limit for a tool result, so it arrives inline rather
46
47
  than as a saved file, each file's entry on a line of its own. Past the budget, it cuts one file at a time, making
47
48
  each cut across the files before the next: a `description` over 300 characters ends at a sentence end, then `(N more
@@ -52,8 +53,7 @@ whose outline lines were cut; a file whose only cut is its description is not na
52
53
  each heading of a cut file, `(N more, lines A-B)`, or `(N more under M headings, lines A-B)`, says how many items
53
54
  its section held and which lines of the file hold it, so read just those lines where the survey needs them, not the
54
55
  whole file. `outlines_left_out` names files at path and size alone. Run `show-candidate-outlines PATH...` for needed
55
- outlines; request fewer paths if it omits any. Root CLAUDE.md and AGENTS.md keep outlines even past the budget.
56
- In git, `untracked` names each listed file git does not track, and
56
+ outlines; request fewer paths if it omits any. In git, `untracked` names each listed file git does not track, and
57
57
  each file a listed link leads to that git does not track: it loads into context all the same, but start-audit
58
58
  refuses a member in it, or read through a link to it, until the file is committed, so ask the project's
59
59
  owner before mapping one. `ignored` names each file in those places that git ignores, by any ignore file, a global
@@ -12,13 +12,12 @@ match, so check it before you fill in `NEW_PATH`.
12
12
 
13
13
  Otherwise it lists each changed member with `since`: whether it was compared with the last audit (`audit`) or with
14
14
  the commit that mapped the member where it is (`mapping_commit`), and that commit, and `history`: the commits after
15
- which the member's own text differed, newest first, and `stopped_at`, which says where the walk back ended and why.
15
+ which the member's own text differed, newest first, given with `--history`, and `stopped_at`: where the walk ended.
16
16
  It ends at the first commit whose text matches the baseline, so a fix an audit already took in is not listed. It
17
17
  follows a member that `move-member --path` moved to a renamed file. A merge is compared with its first parent. `uncommitted` says whether the text on disk differs from HEAD.
18
- `compared_with` counts each principle's members by baseline, `no_baseline` among them, and `counts` holds every
19
- state: `unchanged` for a member as its last audit or acknowledgement recorded it, `unchanged_since_mapping`
20
- for one compared only with the commit that mapped it, which no audit has assessed, and `no_baseline` for a member with
21
- no earlier text to compare with.
18
+ `compared_with` counts each principle's members by baseline, `no_baseline` among them, and `counts` holds every state:
19
+ `unchanged` for a member as its last audit or acknowledgement recorded it, `unchanged_since_mapping` for one compared
20
+ only with the commit that mapped it, which no audit has assessed, and `no_baseline` for a member with no earlier text.
22
21
  `no_baseline_because` says why, for each principle with one: `outside_git`, where no completed audit assessed it,
23
22
  so a completed audit gives each one; or `not_committed`, where no commit holds the member where its map places it,
24
23
  so committing those of the map and the member's file that differ from HEAD or are untracked gives it one,
@@ -39,7 +38,7 @@ Run it after a commit that touches a mapped member's file, and at the start of a
39
38
 
40
39
  `--short` is for a git hook or a heartbeat that acts on an exit status and short lines alone. It prints one line per
41
40
  changed member on stdout, with these tab-separated fields: its principle, its id, the newest commit that changed it
42
- (or `uncommitted`), whose subject and earlier commits the JSON result's `history` gives, and what it was compared
41
+ (or `uncommitted`), whose subject and earlier commits `--history` adds to the JSON result, and what it was compared
43
42
  with: `audit` when an audit or acknowledgement assessed its text, or `mapping_commit`
44
43
  when no audit has, so only the commit that mapped it gives a baseline, then `waiting_on_an_upgrade` for one compared
45
44
  with hashes a later copy wrote. Members compared with an audit come first. Control and invisible characters in a field
@@ -56,8 +55,8 @@ it, else run in the project it names once, and says when there are no maps, or m
56
55
  stdout would hide. A changed member stays listed until an audit takes it in: a notice, not a gate that blocks commits.
57
56
  For a post-commit hook, run: %{executable} list-member-problems --short || true
58
57
  A heartbeat can compare each line's commit with the last one it reported.
59
- `--short --session-start SOURCE`, for the session-start hook, prints instead a line for each principle with changed
60
- audited members, its count and, to run before the user's task, this command for that principle.
58
+ `--short --session-start SOURCE`, for the session-start hook, prints one line instead: a changed principle's count
59
+ and this command for it, to run before the user's task, or, for several, their count and `--short`, which lists them.
61
60
 
62
61
  `--commits-after COMMIT --hook-event EVENT` is for a Claude Code hook that runs after a Bash call, so a long session
63
62
  learns of a member it changed at the commit that changed it, not only at its next start. The plugin's after-commit
@@ -45,18 +45,17 @@ write-up there, since git's match can pair unrelated files: check it. When `reco
45
45
  `starting_at` exactly once, within its heading's section when it names one, as a member's passage must. false can mean
46
46
  an unrelated file, or only a heading renamed there.
47
47
 
48
- To point `recorded_at` at a write-up that moved without a full audit, run `start-audit ID --write-ups`. Its request
49
- lists the principle's open findings, each as this command lists it. Answer `repoints`, one per finding, with the new
50
- `recorded_at`, or null to leave it, and a one-line `reason`. `submit-answer` checks that each new pointer is found, then
51
- changes only those pointers in the audit record, keeping beside each finding `repointed`: where it pointed before, where
52
- it points now, when and why. Its result lists the finding ids it `repointed` and those left `unchanged`, and under
53
- `other_write_ups_not_found` each other principle's finding whose write-up cannot be found, with the request that
54
- repoints each principle's. Commit the record. The finding stays open for the next full audit to decide. During a full
55
- audit, give the new `recorded_at` in that finding's `still_holds` decision instead. Do not edit the record by hand,
56
- since nothing would check the new pointer. It is refused with `cannot_repoint` while an audit is left open outside git,
57
- and before any audit completed; with `unknown_finding` for a finding that is not open, `duplicate_finding` for one named
58
- twice, `invalid_answer` for a new `recorded_at` without a `reason`, and `uncommitted_files` while its file differs from
59
- the last commit. `--member` with it is refused.
48
+ To change what an open finding waits on, its action or its write-up without a full audit, run `start-audit ID
49
+ --open-findings`, which lists the principle's open findings as this command does; its `decisions` template names each by
50
+ `finding_id` alone, printed bare by `--as template` under `decision_fields`, which names each field a decision may give
51
+ and what it means, and which the answer may send back unread; `--write-ups`, which it replaces, is refused with
52
+ `replaced_option`. Give only what changes, each with a one-line `reason`; an `action` closing a finding is a full
53
+ audit's. `submit-answer` keeps each change beside its finding, and lists the ids it `changed` under
54
+ `open_findings_decided`, and under `other_write_ups_not_found` each other principle's finding whose write-up cannot be
55
+ found. Commit the record; the next full audit decides the finding. It is refused with `cannot_decide_open_findings`
56
+ while an audit is left open outside git, and before any audit completed; with `unknown_finding` for a finding that is
57
+ not open, `duplicate_finding` for one named twice, `invalid_answer` for a change without a `reason`, and
58
+ `uncommitted_files` while its file differs from the last commit.
60
59
 
61
60
  `--lines` is for deciding whom to tell, as the session-start line asks: it prints each open finding on a line, its
62
61
  principle, id, `waits on:` its `waits_on`, `waits on no one named`, or `accepted` for one that waits on no one by
@@ -11,6 +11,7 @@ A new literal `--ending-at` must occur once after the complete opening in the se
11
11
  1-based line/character columns, and `ending_candidates_omitted`. Quote more specific closing text.
12
12
  Existing stored members and evidence keep the first ending and their hashes; only new add/move is stricter.
13
13
 
14
- An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing,
15
- dashes or quotes, the refusal names that id under `did_you_mean` and starts its repair with this command run on it
16
- instead. This tool never acts on the near miss: check that it is the member you meant before you run it.
14
+ An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing, dashes
15
+ or quotes, or is the heading or passage of exactly one mapped id given without its path, the refusal names that id under
16
+ `did_you_mean` and starts its repair with this command run on it instead. This tool never acts on the near miss: check
17
+ that it is the member you meant before you run it.
@@ -5,6 +5,7 @@ Run during a full audit, between an accepted assessment and its correction, to f
5
5
  in the `changed_map_entries` of the fixed disposition it fixes, and submit the correction. This tool prints both
6
6
  that step and starting the audit, since it cannot tell in git whether a correction is open.
7
7
 
8
- An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing,
9
- dashes or quotes, the refusal names that id under `did_you_mean` and starts its repair with this command run on it
10
- instead. This tool never acts on the near miss: check that it is the member you meant before you run it.
8
+ An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing, dashes
9
+ or quotes, or is the heading or passage of exactly one mapped id given without its path, the refusal names that id under
10
+ `did_you_mean` and starts its repair with this command run on it instead. This tool never acts on the near miss: check
11
+ that it is the member you meant before you run it.
@@ -1,6 +1,7 @@
1
1
  Takes MEMBER out of principle ID. MEMBER is the id `show-principle` lists. The member's file is not
2
2
  touched.
3
3
 
4
- An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing,
5
- dashes or quotes, the refusal names that id under `did_you_mean` and starts its repair with this command run on it
6
- instead. This tool never acts on the near miss: check that it is the member you meant before you run it.
4
+ An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing, dashes
5
+ or quotes, or is the heading or passage of exactly one mapped id given without its path, the refusal names that id under
6
+ `did_you_mean` and starts its repair with this command run on it instead. This tool never acts on the near miss: check
7
+ that it is the member you meant before you run it.
@@ -5,19 +5,20 @@ nothing more, so a shell that leaves stdin open is not kept waiting; it reads no
5
5
  status. In a project with no maps it prints nothing.
6
6
 
7
7
  Otherwise each line it prints starts `principles:`. Input that is not JSON, or names no source a host sends, is read as
8
- a startup. First comes one line for each principle with a member an audit assessed that changed since, counting them,
8
+ a startup. First, when one principle has a member an audit assessed that changed since, comes a line counting them,
9
9
  saying its audit no longer covers them, and asking the agent to run, before the user's task, the `list-member-problems
10
- ID` command that offers acknowledging them or auditing again. An edit to a member no audit has assessed is not counted
11
- here, since it carries no verdict to act on. In git, a line follows for each principle with members no baseline holds
12
- yet, as a session that ended mid-mapping leaves them, saying which files to commit, or the audit to run when every file
13
- is committed already. Outside git only an audit gives a baseline, so that line would repeat at every session, and is
14
- left out. Then a line for each principle whose audit record a later release of principles wrote: this copy does not
15
- check its members, so none of them is counted, and the line says how to update. Then, while any principle awaits its
16
- first full audit, one line counting them, naming none, asks the agent to tell the user and start one background subagent
17
- to follow `show-first-audit-brief`, or to offer the audit at its next pause if it cannot. At resume and compact, when
18
- one may be running already, it gives the count alone and asks for no second one. Last, while any finding an audit
19
- deferred or accepted is open, the one line `list-open-findings --short` prints, worded for the session's start, and
20
- short on resume, whose conversation holds the whole line already.
10
+ ID` command that offers acknowledging them or auditing again; when several principles have, one line counting the
11
+ principles, with the `list-member-problems --short` command that lists them, so the line does not grow with their count.
12
+ An edit to a member no audit has assessed is not counted here, since it carries no verdict to act on. In git, a line
13
+ follows for each principle with members no baseline holds yet, as a session that ended mid-mapping leaves them, saying
14
+ which files to commit, or the audit to run when every file is committed already. Outside git only an audit gives a
15
+ baseline, so that line would repeat at every session, and is left out. Then a line for each principle whose audit record
16
+ a later release of principles wrote: this copy does not check its members, so none of them is counted, and the line says
17
+ how to update. Then, while any principle awaits its first full audit, one line counting them, naming none, asks the
18
+ agent to tell the user and start one background subagent to follow `show-first-audit-brief`, or to offer the audit at
19
+ its next pause if it cannot. At resume and compact, when one may be running already, it gives the count alone and asks
20
+ for no second one. Last, while any finding an audit deferred or accepted is open, the one line `list-open-findings
21
+ --short` prints, worded for the session's start, and short on resume, whose conversation holds the whole line already.
21
22
 
22
23
  When the maps or members cannot be read, as `list-member-problems` would refuse, it prints instead the refusal's code
23
24
  and that command, whose refusal says why and how to repair it, and still exits 0. Stdin that cannot be read is read as
@@ -35,8 +35,8 @@ is allowed when there is nowhere to point, and then `list-open-findings` prints
35
35
 
36
36
  When a full audit's assessment has findings, `next_action` names the command that prints the correction's answer
37
37
  it leads to, `--as template`, with its `request_id` and the `basis` digests filled in, so you never copy them by
38
- hand; `show-open-correction ID` prints the same answer once the assessment is submitted. Redirect it to a file
39
- outside the project, such as under `$TMPDIR`, and fill only its `dispositions`: each `action` names the four actions
38
+ hand; `show-open-correction ID` prints the same answer once the assessment is submitted. Redirect it to the file
39
+ `next_action` names by its full path, outside the project, and fill only its `dispositions`: each `action` names the four actions
40
40
  and what each adds. Submit it after the assessment, as `next_action` says; the assessment writes the open record the
41
41
  correction is checked against. `--as template` refuses with `no_correction_to_fill` an answer that leads to none.
42
42
 
@@ -3,8 +3,8 @@ Prints the answer to fill for the correction a full audit's assessment with find
3
3
  again. It reads principle ID's open audit record and writes nothing.
4
4
 
5
5
  It prints the correction's answer alone: its `request_id` and `basis`, which you hand back unchanged, and one disposition for each finding to fill.
6
- Redirect it to a file outside the project, such as under `$TMPDIR`, fill only its `dispositions`, and
7
- submit it with `submit-answer --file FILE`. It prints the same answer in git and outside it, and still
6
+ Redirect it to the file `submit-answer`'s `next_action` names by its full path, outside the project, fill only
7
+ its `dispositions`, and submit it with `submit-answer --file` and that path. It prints the same answer in git and outside it, and still
8
8
  after you fix members, which leaves the correction current; `submit-answer` checks it as usual.
9
9
 
10
10
  It refuses with `no_open_correction` while none is open to print. With no audit open, or only a completed
@@ -1,8 +1,8 @@
1
- Asks you to assess every member of principle ID and the set as a whole. Run it after mapping and when `show-principle`
2
- reports a member changed, unassessed, locator_lost or unavailable. `--part PART` prints one part, a member's with its
3
- `text` and `lines_in_text`, an instruction or `response_template` as printed (`part_empty` if empty), `--as template
4
- --part members/ID` a slot; `--part index` lists `part_command`, each one's `bytes`, whether `this_audit` `judges` or
5
- `carries_forward` a member, as `read_in_parts` says, `trimmed_instructions`, then `answer_with` and the `next_action`.
1
+ Asks you to assess every member of principle ID and the set. Run it after mapping and when `show-principle` reports a
2
+ member changed, unassessed, locator_lost or unavailable. `--part PART` prints parts, sized in `part_bytes`: a member's
3
+ with its `text` and `lines_in_text`, an instruction as printed or `response_template` bare (`part_empty` if empty),
4
+ `--as template --part members/ID` slots; `--part index` lists `part_command`, their `bytes`, whether `this_audit`
5
+ `judges` or `carries_forward` a member, `trimmed_instructions`, `answer_with` and `next_action`, per `read_in_parts`.
6
6
 
7
7
  `start-audit` itself writes nothing. `submit-answer` writes the audit record, `.principles/audits/ID.json`: a full audit
8
8
  writes it open when its assessment has findings, completed once it has none or its correction is accepted. In git,
@@ -30,12 +30,12 @@ After a full audit, a member carries `carried_forward`, with its `assessed_at`,
30
30
 
31
31
  ## Prior findings
32
32
 
33
- When the last completed audit deferred or accepted findings, `context.prior_findings` lists them, with `first_raised_at`
34
- and a deferral's `waits_on` and `waits_on_since`. An older one may claim an earlier one with `raised_in`, from the
35
- record's `git log --follow`. Each listed finding shows its `evidence`, in git each item with `changed_since_last_audit`
36
- and `found_now`, or `evidence_not_kept` and an `evidence_request` for `problem_evidence`, whose `replaces` re-points a
37
- lost item. Decide each in `prior_finding_decisions` as `still_holds`, `resolved`, `withdrawn` or `raised_again`, as
38
- `prior_findings_instruction` says; only `resolved` may give `evidence`. Results name `prior_findings_pointers_dropped`,
33
+ When the last completed audit deferred or accepted findings, `context.prior_findings` lists them, with
34
+ `first_raised_at`, its `waits_on` and `waits_on_since`, changes since as `changed_since_audit`; an older one may claim
35
+ `raised_in`, found by `git log --follow`. Each listed finding shows its `evidence`, in git each item with
36
+ `changed_since_last_audit` and `found_now`, or `evidence_not_kept` and an `evidence_request` for `problem_evidence`,
37
+ whose `replaces` re-points a lost item. Decide each in `prior_finding_decisions` as `still_holds`, `resolved`,
38
+ `withdrawn` or `raised_again`; only `resolved` may give `evidence`. Results name `prior_findings_pointers_dropped`,
39
39
  `prior_findings_waits_on_dropped`, `prior_findings_evidence_replaced`, `prior_findings_problems_restated`.
40
40
 
41
41
  ## Members to check against the activation
@@ -64,4 +64,4 @@ full audit's correction fixed carries `audit_base_commit`: judge only the change
64
64
 
65
65
  ## Outside git
66
66
 
67
- Outside git, the open record also keeps what the audit began from and, until its correction completes, prior findings.
67
+ Outside git, the open record also keeps what the audit began from and, until its correction completes, prior findings.
@@ -6,7 +6,7 @@ at a pause, since principles would ask.
6
6
  2. Read the request in parts, which costs about the bytes of the whole request and its member files. Type
7
7
  part_command and then the part as printed, never in a shell variable. Its parts: %{index}
8
8
 
9
- 3. Keep every answer file at $TMPDIR/principles-%{id}-answer.json, never in the project. Redirect the template
9
+ 3. Keep every answer file at %{answer_file}, never in the project. Redirect the template
10
10
  below there and edit it, running each member check the request names and no script over this output.
11
11
  Check it with show-answer-check, then submit-answer, each with --file and that path; answer a
12
12
  correction the same way. On a stale_request refusal, start once more. Its template: %{template}
@@ -0,0 +1,2 @@
1
+ %{count} principles have changed audited members, so their audits no longer cover them. Before the user's task, run
2
+ %{command} to list them, then acknowledge or audit again.
@@ -21,10 +21,13 @@ module Principles
21
21
  #: (String, **String) -> String
22
22
  def self.markdown(name, **values) = Prompt.read(name).filled(values)
23
23
 
24
- # A prompt that shows a shape by example, as JSON data.
25
- #: (String) -> untyped
26
- def self.data(name)
27
- JSON.parse(File.read(File.join(ROOT, "#{name}.json")))
24
+ # A prompt that shows a shape by example, as JSON data, with each %{name} placeholder in its text filled
25
+ # from values, each written as JSON string content so a quote in it keeps the JSON whole.
26
+ #: (String, **String) -> untyped
27
+ def self.data(name, **values)
28
+ prompt = Prompt.new(name, File.read(File.join(ROOT, "#{name}.json")))
29
+ as_json = values.transform_values { |value| JSON.generate(value).delete_prefix('"').delete_suffix('"') }
30
+ JSON.parse(prompt.filled(as_json))
28
31
  end
29
32
 
30
33
  # Every prompt name, relative to ROOT and without its extension.