principles 0.0.5 → 0.0.6

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 (152) hide show
  1. checksums.yaml +4 -4
  2. data/lib/principles/after_commit_hook_options.rb +4 -1
  3. data/lib/principles/command_line.rb +12 -28
  4. data/lib/principles/command_routes.rb +7 -1
  5. data/lib/principles/controllers/acknowledgement.rb +36 -26
  6. data/lib/principles/controllers/answer.rb +7 -5
  7. data/lib/principles/controllers/assessment.rb +14 -3
  8. data/lib/principles/controllers/audit_completion.rb +3 -1
  9. data/lib/principles/controllers/command.rb +2 -2
  10. data/lib/principles/controllers/correction.rb +3 -1
  11. data/lib/principles/controllers/full_audit_request.rb +1 -1
  12. data/lib/principles/controllers/guidance_search_paths.rb +31 -0
  13. data/lib/principles/controllers/inventory.rb +3 -22
  14. data/lib/principles/controllers/mapping.rb +9 -1
  15. data/lib/principles/controllers/member_addition.rb +65 -0
  16. data/lib/principles/controllers/member_entries.rb +6 -24
  17. data/lib/principles/controllers/member_problems_report.rb +2 -2
  18. data/lib/principles/controllers/members_to_assess.rb +1 -1
  19. data/lib/principles/controllers/meta_principle_setup.rb +1 -1
  20. data/lib/principles/controllers/repoint.rb +5 -2
  21. data/lib/principles/controllers/survey.rb +60 -0
  22. data/lib/principles/data/audit_files.rb +4 -0
  23. data/lib/principles/data/candidate_files_found.rb +48 -13
  24. data/lib/principles/data/command-steps.json +77 -16
  25. data/lib/principles/data/committed_tree.rb +84 -0
  26. data/lib/principles/data/first_parent_log.rb +48 -0
  27. data/lib/principles/data/first_parent_range.rb +122 -0
  28. data/lib/principles/data/git_command.rb +37 -0
  29. data/lib/principles/data/guidance_search_paths_file.rb +107 -0
  30. data/lib/principles/data/map_files.rb +35 -10
  31. data/lib/principles/data/principles_directory.rb +40 -0
  32. data/lib/principles/data/principles_subfolder.rb +39 -16
  33. data/lib/principles/data/project_files.rb +11 -3
  34. data/lib/principles/data/repository.rb +55 -29
  35. data/lib/principles/data/requested_candidate_files.rb +43 -0
  36. data/lib/principles/data/running_version.rb +3 -5
  37. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +4 -5
  38. data/lib/principles/data/schemas/answer-guide.schema.json +255 -63
  39. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  40. data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
  41. data/lib/principles/data/schemas/correction-answer.schema.json +6 -0
  42. data/lib/principles/data/schemas/guidance-search-paths.schema.json +13 -0
  43. data/lib/principles/data/schemas/member-map-history.schema.json +20 -0
  44. data/lib/principles/data/verified_head.rb +162 -0
  45. data/lib/principles/invocation_options.rb +2 -2
  46. data/lib/principles/models/acknowledgement.rb +28 -6
  47. data/lib/principles/models/acknowledgement_left_as_printed.rb +51 -0
  48. data/lib/principles/models/audit_entry_protecting_map.rb +28 -0
  49. data/lib/principles/models/audit_record.rb +4 -0
  50. data/lib/principles/models/audit_records.rb +34 -8
  51. data/lib/principles/models/candidate_files.rb +17 -6
  52. data/lib/principles/models/candidate_inventory.rb +51 -7
  53. data/lib/principles/models/captured_head.rb +72 -0
  54. data/lib/principles/models/check_since_last_audit.rb +4 -8
  55. data/lib/principles/models/declared_map_changes.rb +25 -9
  56. data/lib/principles/models/declared_member_removals.rb +75 -0
  57. data/lib/principles/models/disposition.rb +4 -2
  58. data/lib/principles/models/fix_only_fields.rb +12 -0
  59. data/lib/principles/models/guidance_search_path.rb +26 -0
  60. data/lib/principles/models/guidance_search_paths.rb +57 -0
  61. data/lib/principles/models/line_span.rb +6 -0
  62. data/lib/principles/models/loaded_files.rb +1 -2
  63. data/lib/principles/models/loading_scope.rb +61 -0
  64. data/lib/principles/models/locator.rb +6 -0
  65. data/lib/principles/models/mapped_principles.rb +39 -37
  66. data/lib/principles/models/member_file.rb +20 -71
  67. data/lib/principles/models/member_history.rb +7 -5
  68. data/lib/principles/models/member_loading_scopes.rb +49 -0
  69. data/lib/principles/models/member_loads.rb +4 -0
  70. data/lib/principles/models/member_mapping_run.rb +30 -0
  71. data/lib/principles/models/member_moves.rb +4 -0
  72. data/lib/principles/models/member_problems.rb +48 -24
  73. data/lib/principles/models/member_region.rb +129 -0
  74. data/lib/principles/models/member_repair_moves.rb +9 -11
  75. data/lib/principles/models/member_snapshots.rb +14 -1
  76. data/lib/principles/models/members_in_consecutive_sections.rb +56 -0
  77. data/lib/principles/models/meta_principle.rb +14 -0
  78. data/lib/principles/models/missing_files.rb +2 -2
  79. data/lib/principles/models/other_templates_placeholders.rb +1 -1
  80. data/lib/principles/models/outline_budget.rb +29 -14
  81. data/lib/principles/models/principle.rb +14 -7
  82. data/lib/principles/models/principle_file_revision.rb +48 -0
  83. data/lib/principles/models/principle_history.rb +46 -19
  84. data/lib/principles/models/principle_lineage.rb +118 -0
  85. data/lib/principles/models/principle_map_revision.rb +39 -0
  86. data/lib/principles/models/principle_mapping_history.rb +132 -0
  87. data/lib/principles/models/principle_members.rb +14 -0
  88. data/lib/principles/models/principle_predecessor.rb +45 -0
  89. data/lib/principles/models/principle_publication.rb +177 -0
  90. data/lib/principles/models/principle_revision.rb +104 -0
  91. data/lib/principles/models/problem_report.rb +17 -5
  92. data/lib/principles/models/project.rb +43 -27
  93. data/lib/principles/models/project_history.rb +45 -25
  94. data/lib/principles/models/record_format.rb +6 -0
  95. data/lib/principles/models/reported_check.rb +2 -1
  96. data/lib/principles/models/sent_answer.rb +10 -0
  97. data/lib/principles/models/survey_search_paths.rb +26 -0
  98. data/lib/principles/models/uncommitted_files.rb +50 -0
  99. data/lib/principles/models/unknown_principle.rb +29 -0
  100. data/lib/principles/positional_arguments.rb +37 -0
  101. data/lib/principles/version.rb +2 -2
  102. data/lib/principles/views/acknowledgement_result.rb +16 -12
  103. data/lib/principles/views/added_member.rb +41 -0
  104. data/lib/principles/views/answered_request.rb +21 -0
  105. data/lib/principles/views/assessment_request.rb +2 -1
  106. data/lib/principles/views/audit_result.rb +21 -26
  107. data/lib/principles/views/candidate_files_result.rb +56 -12
  108. data/lib/principles/views/candidate_outlines_result.rb +25 -0
  109. data/lib/principles/views/consecutive_sections_elsewhere.rb +27 -0
  110. data/lib/principles/views/correction_request.rb +32 -1
  111. data/lib/principles/views/guidance_search_paths_result.rb +26 -0
  112. data/lib/principles/views/json_with_entries_on_lines.rb +12 -4
  113. data/lib/principles/views/map_added_to.rb +56 -2
  114. data/lib/principles/views/map_result.rb +22 -42
  115. data/lib/principles/views/maps_needing_members_or_audit.rb +47 -0
  116. data/lib/principles/views/member_change_since_baseline.rb +2 -1
  117. data/lib/principles/views/member_repairs.rb +2 -1
  118. data/lib/principles/views/new_loading_scope.rb +31 -0
  119. data/lib/principles/views/one_member_check_result_template.rb +25 -21
  120. data/lib/principles/views/principle_read_result.rb +4 -1
  121. data/lib/principles/views/principles_with_no_completed_audit.rb +9 -3
  122. data/lib/principles/views/problem_lines.rb +3 -1
  123. data/lib/principles/views/problem_result.rb +8 -3
  124. data/lib/principles/views/prompts/acknowledge-a-change/run-the-check-and-report-it-passing.md +3 -3
  125. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +6 -6
  126. data/lib/principles/views/prompts/assess-every-member/answer-guide.json +67 -43
  127. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
  128. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +12 -0
  129. data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -0
  130. data/lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md +6 -0
  131. data/lib/principles/views/prompts/find-a-principle-to-map/choose-an-existing-or-new-principle.md +2 -0
  132. data/lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md +4 -2
  133. data/lib/principles/views/prompts/find-a-principle-to-map/compare-with-mapped-principles.md +11 -0
  134. data/lib/principles/views/prompts/find-a-principle-to-map/read-left-out-files.md +2 -2
  135. data/lib/principles/views/prompts/find-a-principle-to-map/survey-a-later-range.md +3 -0
  136. data/lib/principles/views/prompts/find-a-principle-to-map/what-each-command-writes.md +4 -4
  137. data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +5 -4
  138. data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +17 -0
  139. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +35 -6
  140. data/lib/principles/views/prompts/learn-what-a-command-does/create-principle.md +16 -0
  141. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +37 -4
  142. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +5 -4
  143. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +5 -0
  144. data/lib/principles/views/prompts/learn-what-a-command-does/remove-guidance-search-path.md +13 -0
  145. data/lib/principles/views/prompts/learn-what-a-command-does/remove-principle.md +25 -0
  146. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +26 -0
  147. data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +21 -0
  148. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +2 -2
  149. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +51 -54
  150. data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +7 -0
  151. metadata +55 -4
  152. data/lib/principles/models/candidate_listing.rb +0 -41
@@ -1,58 +1,82 @@
1
1
  {
2
2
  "finding": {
3
- "id": "F1",
4
- "member_ids": [
5
- "a member id from the map"
6
- ],
7
- "problem": "What is wrong",
8
- "consequence": "What goes wrong for an agent because of it",
9
- "proposed_action": "The concrete change",
10
- "evidence": [
11
- {
12
- "path": "a project file",
13
- "heading": "optional exact heading"
14
- },
15
- {
16
- "path": "a project file",
17
- "starting_at": "text that occurs once",
18
- "ending_at": "optional closing text"
19
- },
20
- {
21
- "path": "a project file with frontmatter",
22
- "query": "$.description"
3
+ "copy_to": "response_template.findings",
4
+ "copy_from": "Append one filled examples.finding object to this array. Do not submit this wrapper or notes.",
5
+ "examples": {
6
+ "finding": {
7
+ "id": "F1",
8
+ "member_ids": [
9
+ "a member id from the map"
10
+ ],
11
+ "problem": "What is wrong",
12
+ "consequence": "What goes wrong for an agent because of it",
13
+ "proposed_action": "The concrete change",
14
+ "evidence": [
15
+ {
16
+ "path": "a project file",
17
+ "heading": "optional exact heading"
18
+ },
19
+ {
20
+ "path": "a project file",
21
+ "starting_at": "text that occurs once",
22
+ "ending_at": "optional closing text"
23
+ },
24
+ {
25
+ "path": "a project file with frontmatter",
26
+ "query": "$.description"
27
+ }
28
+ ]
23
29
  }
24
- ]
30
+ },
31
+ "notes": "Evidence entries illustrate locator choices, not mandatory sample files: replace the example array with the actual located references needed for this finding. Fill every judgement and use mapped member IDs. Submitting findings starts a separate correction stage; it does not complete the audit."
25
32
  },
26
33
  "member_delivery": {
27
- "not_observed": {
28
- "delivery": "not_observed"
34
+ "copy_to": "response_template.member_assessments entry matching member_id",
35
+ "copy_from": "Merge only examples.observed or examples.not_observed into that existing entry, then fill its fields. Do not submit this wrapper or notes.",
36
+ "examples": {
37
+ "not_observed": {
38
+ "delivery": "not_observed"
39
+ },
40
+ "observed": {
41
+ "delivery": "observed",
42
+ "observation": "What you saw the member do, where you saw it, and what you did not see",
43
+ "observed_at": null
44
+ }
29
45
  },
30
- "observed": {
31
- "delivery": "observed",
32
- "observation": "What you saw the member do, where you saw it, and what you did not see",
33
- "observed_at": "Only when you saw it before this audit: when, in UTC as audited_at gives it; omit it, or give null, for a sighting made now. When the sighting is a dated record you read during this audit, such as a note or log of the mechanism acting, give the record's date, not the time you read it"
34
- }
46
+ "notes": "Reading source alone is not observed delivery. With not_observed, omit observation and observed_at; remove any substantive sighting fields from a previous choice. For a sighting now, leave observed_at null or omit it. For an earlier sighting, replace null with its UTC time in audited_at's form. When the sighting is a dated record you read during this audit, such as a note or log of the mechanism acting, give the record's date, not the time you read it"
35
47
  },
36
48
  "recent_decision": {
37
- "assessed": {
38
- "assessment": "How the decision held up against the members' own words; when only a commit message records it, name the commit by its sha and subject here",
39
- "evidence": [
40
- {
41
- "path": "a project file that records the decision; when only a commit message records it, the file that commit changed to carry it out",
42
- "heading": "optional exact heading"
43
- }
44
- ]
45
- },
46
- "unavailable": {
47
- "unavailable_reason": "Why no recent decision under this principle can be checked"
49
+ "copy_to": "response_template.recent_decision",
50
+ "copy_from": "Replace the whole object with only examples.assessed or examples.unavailable, then fill its fields. Do not merge alternatives or submit this wrapper.",
51
+ "examples": {
52
+ "assessed": {
53
+ "assessment": "How the decision held up against the members' own words; when only a commit message records it, name the commit by its sha and subject here",
54
+ "evidence": [
55
+ {
56
+ "path": "a project file that records the decision; when only a commit message records it, the file that commit changed to carry it out",
57
+ "heading": "optional exact heading"
58
+ }
59
+ ]
60
+ },
61
+ "unavailable": {
62
+ "unavailable_reason": "Why no recent decision under this principle can be checked"
63
+ }
48
64
  }
49
65
  },
50
66
  "reassessment": "Give a reassessment only for a fixed finding; omit it for deferred, accepted or disagreed.",
51
67
  "check_result": {
52
- "command": "the member's check, exactly as context.members lists it",
53
- "exit_status": 0,
54
- "review_basis": "One line saying what the review before the run rested on; needed beside exit_status when check_since_last_audit is new or changed",
55
- "not_run_reason": "Instead of exit_status, when you could not run it here: why, such as a missing tool or a sandbox",
68
+ "copy_to": "response_template.member_assessments entry matching member_id, inside check_result",
69
+ "copy_from": "Merge only examples.ran or examples.not_run into that existing object, then fill command and outcome. Leave unused fields exactly as that member's template printed them. For a new or changed run, write its review_basis; for an unchanged run, keep its own review_basis placeholder to retain the earlier line, or write a new basis. Do not submit this wrapper or limits.",
70
+ "examples": {
71
+ "ran": {
72
+ "command": "the member's check, exactly as context.members lists it",
73
+ "exit_status": 0
74
+ },
75
+ "not_run": {
76
+ "command": "the member's check, exactly as context.members lists it",
77
+ "not_run_reason": "Instead of exit_status, when you could not run it here: why, such as a missing tool or a sandbox"
78
+ }
79
+ },
56
80
  "limits": "Give a checked member's check_result in its own entry in member_assessments, where the template starts it, and none for a member without a check. A member that names a check asks for it to run at each full audit, however long it takes; if it is too slow to run at every audit, say so as a finding rather than skip it. Do not count on a permission prompt to show the command to anyone first. unchanged means an earlier audit ran this same command, not that it is safe: the audit record is committed too, and can be changed beside the check. Run the command in the project before you report its exit status: nothing runs it automatically, and nothing confirms that a reported run happened, that it ran on the files as they are now, or that the status is the one it returned. A failing check is a fact for your assessment; whether the member delivers stays your judgement."
57
81
  }
58
82
  }
@@ -4,6 +4,7 @@
4
4
  "action": "fixed",
5
5
  "reason": "What you changed, in one line",
6
6
  "changed_members": ["the id of each member the fix changed"],
7
+ "removed_members": ["the id of each member the fix removed from the map"],
7
8
  "evidence": [{ "path": "a project file", "starting_at": "text that occurs once in the fixed passage" }],
8
9
  "reassessment": "How the changed member reads now, and any check you ran on it",
9
10
  "recorded_at": null
@@ -23,3 +23,15 @@ If the fix is to map a member the finding says is missing, add it with `add-memb
23
23
  changed. No assessment has read it, so the record gives it no baseline: the completed result names it under
24
24
  `members_added_awaiting_assessment`, and the next full audit assesses it. Outside git, a member added now is refused:
25
25
  defer the finding and add the member after the audit.
26
+
27
+ If the fix removes obsolete guidance from the map, use `remove-member`, keeping its source file, then list its
28
+ original id in that fixed disposition's optional `removed_members`. In git, the union of those lists must explain
29
+ exactly the map removals; repeated claims are allowed. Each removed id must exist at the audit base, be absent now,
30
+ and appear in neither `moved_members` nor `changed_map_entries`. `changed_members` names current text changes; leave
31
+ it empty for a removal-only fix. Give a substantive reassessment and at least one located evidence pointer about
32
+ the remaining guidance for a fix with only removals. This tool checks the pointer, while you judge its relevance.
33
+ Leave a survivor or add a replacement; a new member still awaits assessment. Existing findings keep their original
34
+ member attribution and age even when their member was removed. An empty endpoint cannot complete this correction:
35
+ retain the correction packet and restore the map entries before reconsidering or deferring, or explicitly deactivate
36
+ the principle while retaining its previous audit history. A removal grants no permission to delete a source file.
37
+ Non-fixed dispositions omit `removed_members` or leave it empty. Without git, map removals cannot be verified.
@@ -0,0 +1,4 @@
1
+ Keep the exact original assessment you submit (or the exact stdin bytes for `--file -`) and this correction
2
+ packet before changing members. Save copies outside the project, including the correction's request_id,
3
+ basis and response_template or correction_template, and fill only its dispositions. Git cannot reconstruct
4
+ your assessment judgements.
@@ -0,0 +1,6 @@
1
+ After the table, ask where else this repository keeps guidance agents follow, including other harness folders,
2
+ linked documents, templates and executable checks. You judge which files carry principles; this inventory does not
3
+ establish that a host loads them. To include a location in a read-only survey now, repeat --also with a quoted
4
+ root-relative glob. This option does not record the location for later surveys.
5
+ After the table, record chosen search paths with add-guidance-search-path; remove-guidance-search-path stops recording one.
6
+ Saved search paths are included automatically and named in recorded_guidance_search_paths when nonempty.
@@ -0,0 +1,2 @@
1
+ After the table, ask which existing principle to extend with add-member, or which distinct principle to map with
2
+ create-principle. For a new map, choose a lower-kebab-case id and describe what the principle is and why it matters.
@@ -1,8 +1,10 @@
1
1
  Survey this project's principles: the rules that several pieces of its agent guidance reinforce together. Read
2
- each listed file's outline, description and opening line printed here, not the files themselves. Show the user one
2
+ each listed Markdown file's outline, description and opening line printed here, not the files themselves.
3
+ For a selected non-Markdown file listed by path and size, inspect that file only if needed to judge the rule it
4
+ enforces; listing it does not show its contents. Show the user one
3
5
  table, with a row for each principle: a name of a word or two, a one-line description, and the files and sections
4
6
  that carry it. Members can also be rules, skills, hooks, reminders, scripts, data files or build checks anywhere in
5
- the project; the inventory lists only the usual places. Ask nothing and write nothing until the table is shown. If
7
+ the project; inventory.scope states what this survey covers. Ask nothing and write nothing until the table is shown. If
6
8
  nothing here reinforces a principle, say so and stop.
7
9
 
8
10
  Under the table, name the files that look ticket-local or boilerplate, such as one task's notes or a template left
@@ -0,0 +1,11 @@
1
+ Survey this project's principles using each listed Markdown file's outline, description and opening line printed here,
2
+ not the files themselves. For a selected non-Markdown file listed by path and size, inspect that file only if needed
3
+ to judge the rule it enforces; listing it does not show its contents.
4
+ Compare each rule with the id and description in mapped_principles: is it a facet of
5
+ an existing principle, another member carrying that principle, or a distinct principle?
6
+ A row with a refusal has no readable description: resolve its repair before deciding a rule is distinct. You judge; do not create
7
+ a separate map for each wording or file. Show the user one table of principles, each with its description,
8
+ carrying files and sections, and the existing map it belongs to or why it is distinct.
9
+ Ask nothing and write nothing until the table is shown. If nothing here reinforces a principle, say so and stop.
10
+
11
+ Under the table, name ticket-local or boilerplate files with why they may be left out.
@@ -1,3 +1,3 @@
1
1
  This project is too big for every outline to fit, so each file under inventory.outlines_left_out prints its path
2
- and size alone. No command prints those files' outlines yet. Where the survey needs one, open that file and read
3
- its headings and lists yourself.
2
+ and size alone. Where the survey needs one, run show-candidate-outlines PATH... with those literal paths.
3
+ Request fewer paths at once if that result also leaves outlines out.
@@ -0,0 +1,3 @@
1
+ The outlines of the files the range changed print %{bytes} B on their own, past the budget, so this result passes
2
+ it too. Which of them to survey is your call: name a later REV, so fewer commits are surveyed, or read the outlines
3
+ of the files the change is about and leave the rest.
@@ -1,4 +1,4 @@
1
- This command wrote nothing. Commands starting create, change, add, move or remove write %{map_file},
2
- a map to commit as it changes, so the project's history shows each change and can undo it. Commands starting start or submit write only
3
- .principles/audits/ID.json, when an audit completes, for the project to commit. Commands starting list or show write nothing. This tool
4
- edits none of the project's guidance.
1
+ This command wrote nothing. Map commands write %{map_file}.
2
+ add-guidance-search-path and remove-guidance-search-path write only .principles/guidance-search-paths.json.
3
+ Audit start/submit steps write only .principles/audits/ID.json; wrote names any changed record.
4
+ Commit changed records. list/show commands write nothing. This tool edits none of the project's guidance.
@@ -1,10 +1,11 @@
1
- Only CLAUDE.md, AGENTS.md and .claude rules, skills, agents and settings in this project, leaving out files git
2
- ignores, which in git are named under ignored and not listed to map. The host may still load an ignored file, such
1
+ By convention, CLAUDE.md, AGENTS.md and .claude rules, skills, agents and settings in this project. Also included are Markdown files changed by --commits-after,
2
+ changed mapped files, and files explicitly selected with --also or recorded guidance search paths. Explicit glob matching respects internal, package and nested-project traversal boundaries. Files git
3
+ ignores are named under ignored and not listed to map. The host may still load an ignored file, such
3
4
  as personal local settings, which can hold hooks and permissions, and whose hooks show-principle reads for
4
5
  named_in_hooks; while it is ignored and uncommitted, an audit refuses a member in it, so a rule only it enforces
5
6
  stays outside every audited map. Markdown and settings files are listed by name, except that a skill lists only its
6
- SKILL.md, the file the harness loads. Any other file there, such as a skill's references, templates or scripts, is
7
- counted under its directory in other_files_by_directory, so read one when it may hold a member. Members elsewhere in
7
+ SKILL.md, the file the harness loads, unless explicitly selected with --also, recorded search paths or the commit range. Any other file there, such as a skill's references, templates or scripts, is
8
+ counted under its directory in other_files_by_directory, so read one when it may hold a member. Explicit selections list other text files by path and size, without Markdown outlines. Members elsewhere in
8
9
  the project are just as valid, and often the strongest: git hooks, CI workflows and executable scripts enforce a
9
10
  principle, where instructions only state it. Look there too, and add any that reinforce the principle. Nothing is
10
11
  executed; delivery is not observed.
@@ -0,0 +1,17 @@
1
+ After showing the user the principles table, save where to look for this project's agent instructions and checks.
2
+ A guidance search path selects files for a survey; it does not map a principle or establish host delivery.
3
+ Use list-candidate-files --also with a quoted project-relative file pattern to try a selection before recording it.
4
+
5
+ %{executable} add-guidance-search-path 'guides/**/*.md'
6
+
7
+ Writes only `.principles/guidance-search-paths.json`, in the selected project's store; commit it as it changes.
8
+ The glob is normalized as --also normalizes it. A duplicate addition returns `unchanged` with an empty `wrote` list
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.
11
+ No map, audit record or guidance file is changed, and nothing is executed.
12
+
13
+ Blank, absolute or parent-traversing patterns are refused as `invalid_guidance_search_path`. Invalid JSON or schema
14
+ is refused as `unparseable_guidance_search_paths` or `invalid_guidance_search_paths`; `newer_guidance_search_paths` asks for
15
+ an upgrade while preserving the newer file. A linked store or configuration is refused as `symlinked_directory`
16
+ or `symlinked_guidance_search_paths`, including a dangling link. `guidance_search_paths_io_error` reports an unreadable
17
+ or unwritable store; repair it before retrying. A missing file is an empty list, not a reason to hide an access error.
@@ -8,6 +8,34 @@ how to show it, what to do next and, while a correction may be open, how a fix c
8
8
  principle's first member or, in git once it has a commit, while the map file is as last committed, so members
9
9
  mapped in one sitting do not each repeat them.
10
10
 
11
+ If the keeping principle's map was removed, commit that removal before its first add-member recreates it.
12
+ `map_removal_not_committed` refuses while its map path remains at committed HEAD; `git_history_unavailable`
13
+ refuses when that history cannot be verified. Existing-map additions keep their ordinary behavior.
14
+
15
+ When one or two members are mapped and this copy knows no full audit has completed, that reminder asks whether
16
+ every carrier is included and whether a member belongs to another principle. This is a question, not a minimum
17
+ map size or a merge decision; unreadable/newer audit state does not count as known absence.
18
+
19
+ `added.new_loading_scope` appears when this member has known literal loading-scope qualifiers not already mapped,
20
+ and at least one prior known scope differs. `scope` and `already_mapped` (grouped `member_ids`) show the new and
21
+ prior facts. `loading_basis` is `host: claude_code`, `kind: documented_prediction`,
22
+ `session_start_assumption: project_root`; it is not observed delivery or a Codex derivation.
23
+ The question asks whether carriers will be available where
24
+ the principle applies, or should link to another carrier. This cue does not depend on audit history or the
25
+ per-sitting reminder; adding another member in an already represented scope does not repeat it.
26
+ The projection keeps when, context, invoked_by, skill_part and description qualifiers, with literal files and
27
+ paths_field lines in their original order; it excludes sizes and hook references and does not interpret globs.
28
+ `not_loaded` is a known no-load prediction. `not_determined` and `no_known_carrier`, even nested, are unclassified:
29
+ `not_compared` lists each unclassified `member_id` and `scope` only beside a positive hint, never as evidence
30
+ of equal scope, difference or delivery.
31
+ Unknown new scopes or only unknown prior scopes give no new-scope field or cue.
32
+
33
+ `added.consecutive_sections_elsewhere` names other maps' members in consecutive complete Markdown sections
34
+ of the same underlying file, with their path, role and current lines, only when all named maps lack a completed
35
+ full audit. Only heading locators without passage/query qualifiers qualify; spans meet without overlap or a gap.
36
+ The question asks whether they carry one rule or distinct principles; location alone does not decide.
37
+ Unreadable/unknown audit or member facts are omitted, and an empty group and its note are absent.
38
+
11
39
  When the new member shares a line with members already mapped, `added` names them, so you see that one
12
40
  edit there will show as a change to each: `overlaps` lists those in this principle, and `mapped_elsewhere`
13
41
  those in other principles, each with its principle, its id, the role it plays there and its `first_line` and
@@ -30,12 +58,13 @@ The location flags narrow the member; omit them for a whole file. Give both to t
30
58
 
31
59
  - `--section HEADING`: a Markdown heading's exact text without its # marks. The section runs to the next
32
60
  heading of the same or a higher level.
33
- - `--starting-at TEXT`: a passage starting at TEXT, which must occur once. It runs to the end of that
34
- line, or with `--ending-at TEXT` to the end of the first TEXT after it. `--ending-at` matches text,
35
- not whole lines, so quote enough of it. The member's id ends with `@TEXT`, and later commands such as
36
- `change-member-role` and `start-audit --member` take that id. This tool quotes it in each command it
37
- prints, but you may type it yourself, so choose a short TEXT without backticks, quotes or `$`,
38
- which a shell would need quoted.
61
+ - `--starting-at TEXT`: one literal opening; without `--ending-at TEXT`, the passage ends at its line's end.
62
+ A new literal ending must occur once after the complete opening in the selected region; overlapping matches count.
63
+ `ambiguous_passage_end` refuses before writing, with exact `eligible_ending_count`, up to five `ending_candidates`
64
+ (1-based line/character column), and `ending_candidates_omitted`. Quote more specific closing text.
65
+ Existing stored members and evidence use the first ending with unchanged hashes; only new add/move is stricter.
66
+ The member's id ends with `@TEXT`; `change-member-role` and `start-audit --member` take it.
67
+ This tool quotes it in each command it prints. For manual typing, choose short TEXT without backticks, quotes or `$`.
39
68
  - `--query '$.FIELD'`: one top-level field of a Markdown file's frontmatter, such as `$.description`,
40
69
  which is what makes a skill or subagent load. A query is standard JSONPath, so a name with a hyphen
41
70
  goes in brackets: `$['allowed-tools']`. The member is the field's lines as the file writes them:
@@ -2,5 +2,21 @@ Maps a new principle under ID, a lower-kebab-case name for it, with TEXT saying
2
2
  and why it matters. The map, `.principles/maps/ID.json`, holds that description and the members you add;
3
3
  commit it as it changes.
4
4
 
5
+ If this ID's map was removed or changed to another ID, commit that removal before recreating it. A map still
6
+ present at committed HEAD refuses with `map_removal_not_committed`, even if its old contents are unreadable.
7
+ Unavailable Git history refuses with `git_history_unavailable`; restore access and retry. Healthy projects
8
+ outside Git can still create maps. Before a repository's first commit, verification needs Git supporting
9
+ `show-ref --exists`; otherwise make an initial commit or upgrade Git, then retry.
10
+
5
11
  `sticking-to-your-principles` is refused as `meta_principle_id`: run `show-meta-principle-passage`, whose
6
12
  printed `add-member` creates that map with its first member.
13
+
14
+ Before choosing its members, survey the guidance if you have not already, comparing the existing maps before
15
+ creating another. To survey the project:
16
+ %{executable} list-candidate-files
17
+
18
+ To survey the principles a committed change carries, name the revision before it:
19
+ %{executable} list-candidate-files --commits-after REV
20
+
21
+ A surveyed rule that is a facet of an existing principle belongs in that map; add-member adds another place
22
+ carrying it. A distinct principle starts with create-principle, then add-member and its first full audit.
@@ -1,6 +1,40 @@
1
1
  Lists the files in this project that look like agent guidance, and asks you to show the user a
2
2
  table of the principles they reinforce before asking anything, then which one to map.
3
- Run it before any of the project's own principles is mapped.
3
+ Run it before mapping, or to survey guidance a change carries in a project already mapped.
4
+ With maps present, `mapped_principles` lists their ids and descriptions for you to compare with each surveyed rule;
5
+ `existing_maps` keeps the ids alone. Judge whether a rule is a facet of one before creating a distinct principle.
6
+ After showing the table, add-member extends an existing map and create-principle starts a distinct one.
7
+ A map that cannot be read has a `refusal` row with its path and repair instead of a description;
8
+ the survey stays available, but resolve that repair before treating a rule as distinct.
9
+ To include other guidance now, repeat `--also GLOB`, quoting each root-relative glob so the shell does not expand it:
10
+
11
+ %{executable} list-candidate-files --also 'guides/**/*.md' --also '.codex/**/*.md'
12
+
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.
17
+ Globs match case-sensitively: `*` stays in one path segment, `**/` includes deeper folders, braces select alternatives,
18
+ and dotfiles are included. A leading `./` is normalized. Blank or absolute globs, parent segments and NUL are refused
19
+ as `invalid_guidance_search_path`. The inventory still skips internal stores, installed-package folders and nested Git
20
+ projects, and does not traverse symlinked folders. `additional_search_paths` gives each normalized `glob` and its
21
+ `matched_files` count within those boundaries, before ignore/readability filtering; zero means no eligible match,
22
+ not proof that no guidance exists elsewhere. Ignored matches remain unread under ignored facts; other unreadable
23
+ matches give per-path refusals. Overlapping globs list a file only once. Explicit selections are named even inside
24
+ skills: Markdown receives an outline subject to the budget and test-data exclusions, while other text files give
25
+ path and size. They are never executed, and listing does not establish host delivery.
26
+ `--commits-after REV` names the commit a change starts after, as a sha, a branch or `HEAD~3`, for a survey of the
27
+ principles that change carries. The files the commits after REV changed, up to HEAD, list first, each marked
28
+ `changed_in_range`, with any Markdown file they changed outside the places hosts load and any changed file already
29
+ named in a readable principle map. Range-selected Markdown references inside skills are outlined too; a mapped
30
+ non-Markdown file is named by path and size, never executed. Unmapped application code is not included just because
31
+ it changed. Selection compares the map's literal member paths; a change only to a symlink target is not promised
32
+ to select every mapped alias. Every other candidate follows,
33
+ as without it. Past the budget, every other file's outline is left out before theirs is cut, and theirs is never
34
+ left out, as an entry file's is not; when they alone pass the budget, `range_outlines_bytes` gives what they print and
35
+ 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
+ since no commit in the range holds it yet: survey it yourself if the change includes it. Outside git it refuses with
37
+ `range_needs_git`, and a REV git resolves to no commit refuses with `unknown_revision`, naming it under `revision`.
4
38
  Each listed Markdown file, except those under `possibly_test_data`, gives its `outline`: its headings in order, as
5
39
  Markdown, outside code fences, and under each its top-level list items, an item by its bold lead or its first 60
6
40
  characters, at most 20 a heading. One with frontmatter gives its `description` too, and leaves the frontmatter
@@ -17,9 +51,8 @@ The root CLAUDE.md and AGENTS.md go after every other file, and keep their outli
17
51
  whose outline lines were cut; a file whose only cut is its description is not named, since its text says so. Under
18
52
  each heading of a cut file, `(N more, lines A-B)`, or `(N more under M headings, lines A-B)`, says how many items
19
53
  its section held and which lines of the file hold it, so read just those lines where the survey needs them, not the
20
- whole file. `outlines_left_out` names each file that prints its path and size alone; no command prints those
21
- outlines yet, so read such a file's headings yourself where the survey needs them. The root CLAUDE.md and AGENTS.md
22
- always keep an outline, so on their own they can still print past the budget.
54
+ 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.
23
56
  In git, `untracked` names each listed file git does not track, and
24
57
  each file a listed link leads to that git does not track: it loads into context all the same, but start-audit
25
58
  refuses a member in it, or read through a link to it, until the file is committed, so ask the project's
@@ -24,10 +24,11 @@ so a completed audit gives each one; or `not_committed`, where no commit holds t
24
24
  so committing those of the map and the member's file that differ from HEAD or are untracked gives it one,
25
25
  and when every one is committed already, a completed audit gives it one. `next_action` names that audit, or those
26
26
  files.
27
- `awaiting_first_audit` names the principles no full audit has completed yet, so whether their members carry them is
28
- unknown, and `next_action` names them all in one line, then each one's `start-audit` on a line of its own,
29
- ready to run. In git a principle joins it once a commit holds its map, or its first audit is open. Outside git its first audit is what gives its members a baseline, so it has no
30
- `no_baseline_because`. Members added to a principle since its last full audit keep a line of their own.
27
+ `no_completed_audit` names readable maps without a completed full audit, even uncommitted. `next_action` counts them
28
+ before baselines without judging meaning or completeness. `empty_maps` names maps with no members, even after an audit.
29
+ Add a member first if empty; commit required files before an audit. Unknown/newer records keep upgrade/refusal guidance.
30
+ `awaiting_first_audit` retains its baseline prerequisite: in git a commit holds the map or an audit is open;
31
+ outside git the audit supplies the baseline. Audited maps' added-member lines remain.
31
32
  This tool compares text, not meaning. When a change alters what a member says, or its check changed, run a full
32
33
  audit with `start-audit ID`. When the member still says the same thing, a completed full audit has judged it and ran
33
34
  its check, if any, in git, acknowledge it with `start-audit ID --member MEMBER`; `next_action` offers that only where
@@ -6,6 +6,11 @@ does not guess the new path: find it with git or by reading the project. The loc
6
6
  and replace the old ones whole, so `--path` alone makes the member the whole file. MEMBER is the id `show-principle`
7
7
  lists. The result says which lines the member now spans.
8
8
 
9
+ A new literal `--ending-at` must occur once after the complete opening in the selected region; overlapping matches count.
10
+ `ambiguous_passage_end` refuses before writing: exact `eligible_ending_count`, up to five `ending_candidates` with
11
+ 1-based line/character columns, and `ending_candidates_omitted`. Quote more specific closing text.
12
+ Existing stored members and evidence keep the first ending and their hashes; only new add/move is stricter.
13
+
9
14
  An id no member has is refused with `unknown_member`. When it differs from one mapped id only in case, spacing,
10
15
  dashes or quotes, the refusal names that id under `did_you_mean` and starts its repair with this command run on it
11
16
  instead. This tool never acts on the near miss: check that it is the member you meant before you run it.
@@ -0,0 +1,13 @@
1
+ Remove a recorded survey location when it no longer identifies this project's guidance. Use the exact normalized
2
+ glob from `recorded_guidance_search_paths`, not a member id or text location.
3
+
4
+ %{executable} remove-guidance-search-path 'guides/**/*.md'
5
+
6
+ Writes only `.principles/guidance-search-paths.json`; commit it. The last removal retains a valid empty configuration.
7
+ The result gives the remaining `recorded_guidance_search_paths`, its `wrote` file and a read-only survey in `next_action`.
8
+ It never removes guidance files, principle maps or audit records. Later surveys automatically use the remaining
9
+ recorded locations; a removed glob stops that extra selection, while conventional and temporary selections still apply.
10
+
11
+ An absent selection is refused as `unknown_guidance_search_path`, with the recorded list to choose from, without
12
+ creating configuration. Invalid globs, malformed or newer configuration, linked files and I/O errors are refused
13
+ as add-guidance-search-path describes; restore or upgrade the store instead of replacing its contents by hand.
@@ -0,0 +1,25 @@
1
+ Remove an obsolete map after its rules have been consolidated or split using change-description, add-member
2
+ and remove-member. The agent decides which rules belong together; this command never merges principles or
3
+ transfers findings. It removes only `.principles/maps/ID.json`, leaving member files and audit history alone.
4
+
5
+ Without `--confirm`, removal is permitted only when there is no current audit entry. That is not a claim
6
+ that the principle was never audited: version control may retain older records. Any current entry protects
7
+ the map, including an open, invalid, newer or dangling entry; `principle_has_audit_record` refuses removal.
8
+
9
+ Use `--confirm` only after deciding that this exact map should leave routine active-map reports. Confirmation
10
+ removes only the map; it preserves the audit entry byte-for-byte and does not resolve retained findings.
11
+ It does not require a readable record, upgrade it or repair a link. Inspect a readable retained record with
12
+ `show-audit ID`; invalid, newer or linked entries may require diagnosis before that read succeeds.
13
+ An access failure while checking for a current audit entry still refuses even with confirmation.
14
+
15
+ The result's `status` is `removed`; `principle_id` identifies it. `removed` lists the exact deleted map path,
16
+ while `wrote` is empty because no file was written. `next_action` names list-principles. In Git, commit the
17
+ removal if the map was tracked; an untracked map's removal needs no Git commit. No Git history is rewritten.
18
+ Before recreating a tracked map's ID, commit its removal: creation refuses while that map path remains at
19
+ committed HEAD. Once absent there, recreation uses its retained audit record as before; use a distinct ID for a distinct principle.
20
+
21
+ Missing or invalid IDs refuse without changes. Linked store parents and final map links refuse rather than
22
+ unlinking a target. Nonregular entries refuse with `not_a_file`. If access prevents checking for an audit entry, the command refuses with
23
+ `store_entry_unreadable`; an entry disappearing after validation or a failed unlink gives `store_remove_failed`. Restore access
24
+ or the intended regular file before retrying. This command does not provide an atomic compare-and-delete
25
+ against concurrent external edits. A final linked map refuses with `symlinked_store_file`.
@@ -4,6 +4,19 @@ with the files submitting would write. Use it instead of searching the project y
4
4
  submit. Pass `--file FILE`, naming the answer written to a FILE outside the project; `--file -` reads it from stdin
5
5
  instead. Its `next_action` ends with `submit-answer`, giving the same `--file` value again.
6
6
 
7
+ The same current-ID history checks apply to assessment/correction answers with a Git base. For their
8
+ `stale_request` and `git_history_unavailable` conditions and repairs:
9
+ %{executable} submit-answer --help
10
+
11
+ For a correction removing obsolete guidance from the map, each fixed disposition may give `removed_members`:
12
+ the original member ids actually removed with `remove-member`, leaving source files intact. The declaration is
13
+ checked against the original Git map. `invalid_removed_members` refuses unknown, still-present or conflicting
14
+ claims; `empty_correction_map` refuses a result without a survivor or replacement. A removal-only fix leaves
15
+ `changed_members` empty and supplies a substantive reassessment and located evidence about remaining guidance.
16
+ Restore entries before reconsidering or deferring an emptied map, preserving the unsubmitted correction packet;
17
+ explicit deactivation retains previous audit history. This preview never writes. The correction question and its
18
+ answer guide give the full declaration contract, including repeated claims and exact Git map reconstruction.
19
+
7
20
  When the answer would write a record that keeps findings open with a write-up, `open_findings_will_print`
8
21
  names each by `finding_id` with what `list-open-findings` will print for it as its `write_up_opening`, its first
9
22
  sentence with hard-wrapped lines joined, or null with the reason. If that line is a bare heading rather than the finding, move the write-up or the
@@ -16,6 +29,19 @@ project, such as under `$TMPDIR`, and fill only its `dispositions`: each `action
16
29
  each adds. Submit it after the assessment, as `next_action` says; outside git the assessment writes the open record
17
30
  the correction is checked against.
18
31
 
32
+ `correction_recovery` explains what to keep before changing members: the exact original assessment you submit,
33
+ including its request_id and basis, and the returned correction packet with its response_template or
34
+ correction_template. Save both outside the project before fixes. For `--file -`, retain the exact stdin bytes
35
+ and supply them again. In Git, after submitting the assessment, recover a lost correction while its request
36
+ inputs remain unchanged by checking the original assessment request with its original answer file again:
37
+
38
+ `%{executable} show-answer-check ORIGINAL_ASSESSMENT_REQUEST_ID --file ORIGINAL_ASSESSMENT_FILE`
39
+
40
+ The result gives the same correction_template and writes nothing. Changed audited members, a completed audit
41
+ or a newer record can refuse replay; recovery after fixes is not promised. Preserve the correction packet
42
+ before editing rather than starting a fresh assessment to reconstruct missing judgements. Outside Git, this
43
+ replay route is not established; retain the original packets.
44
+
19
45
  When a correction's fixed disposition lists `changed_map_entries`, `map_entry_changes` names each such member by
20
46
  `member_id`, under its id after any `moved_members`, with each of its `role` and `check` that changed since the
21
47
  audit began, as `was` and `now`; a removed check is `now` null. Read it before you submit: a change listed that
@@ -0,0 +1,21 @@
1
+ Recover the outlines a survey left out without scanning the project again. Give one or more literal file paths:
2
+
3
+ %{executable} show-candidate-outlines guides/names.md guides/checks.md
4
+
5
+ The command reads only those files, without glob expansion or recorded guidance search paths. Leading `./` is
6
+ removed; repeated paths are listed once, in path order. Paths must resolve to regular UTF-8 text files inside
7
+ the selected project, through any symbolic links too. Each failed path appears under `inventory.unreadable`
8
+ with its `code`, `message`, `repair` and `path`; other requested files still succeed, with exit 0 and `wrote: []`.
9
+ No paths is a usage refusal, exit 2. In git, `ignored` names unread requests, including aliases whose text depends
10
+ on ignored links or targets. Their contents are not read. No success is inferred for a refused or ignored file.
11
+
12
+ `inventory.files` uses the survey's entries: `path`, `characters`, and `symlink_to` when linked. Markdown gives
13
+ `outline`, with its headings and top-level list items, and any `description` and `opening_line` as in
14
+ list-candidate-files. Explicitly requested test-data files and skill references receive outlines too: you chose
15
+ them, and you judge relevance. Non-Markdown text gives path and size alone; open it only if needed.
16
+
17
+ The full rendered result uses the survey's byte budget. `outlines_cut` names shortened outlines, whose line-range
18
+ markers show where to read needed items. `outlines_left_out` names files whose outlines were omitted: request
19
+ fewer paths to recover them. Root entry files retain their outlines and can exceed the budget on their own;
20
+ if one file is still too large, read only its needed headings or line ranges. A result with cuts or omissions
21
+ is incomplete; never treat it as a complete reading of the requested files.
@@ -53,8 +53,8 @@ hook names, and anything under an invoked or always activation or in a one-membe
53
53
  Use `--member MEMBER` when one member was edited but still says the same thing, as `list-member-problems --help`
54
54
  describes; without it, `list-member-problems --short` repeats the edit until a full audit. Its request shows the
55
55
  `baseline_commit` it was last judged at, `member_lines` then and now (or a large member's `changed_region`,
56
- `context_lines` and `from_line`, or `read_instead`), `first_changed_lines` to quote, `read_the_change` and the member's
57
- `deferred_findings` and `accepted_findings`, which stay; its `question` asks for `meaning_kept`. This tool checks both
56
+ `context_lines` and `from_line`, or `read_instead`), `first_changed_lines`, `read_the_change`, `check_instruction` and
57
+ the member's `deferred_findings` and `accepted_findings`; its `question` asks for `meaning_kept`. This tool checks both
58
58
  quotes. An id near a mapped one is refused with `unknown_member`, naming it under `did_you_mean`. A one-member audit
59
59
  writes the record once its answer is accepted, keeping the edit in its `acknowledgements`; commit it. It is refused with
60
60
  `cannot_acknowledge` outside git, while an audit is open, and for a member no completed audit assessed, whose baseline