principles 0.0.10 → 0.0.11

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -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/assessment.rb +1 -1
  7. data/lib/principles/controllers/audit.rb +2 -1
  8. data/lib/principles/controllers/broken_member_repairs.rb +60 -0
  9. data/lib/principles/controllers/command.rb +8 -30
  10. data/lib/principles/controllers/correction.rb +7 -5
  11. data/lib/principles/controllers/full_audit_request.rb +32 -16
  12. data/lib/principles/controllers/inventory.rb +3 -3
  13. data/lib/principles/controllers/member_acknowledgement.rb +5 -5
  14. data/lib/principles/controllers/member_addition.rb +1 -1
  15. data/lib/principles/controllers/member_entries.rb +1 -1
  16. data/lib/principles/controllers/member_problems_report.rb +4 -1
  17. data/lib/principles/controllers/members_to_assess.rb +1 -1
  18. data/lib/principles/controllers/meta_principle_setup.rb +4 -3
  19. data/lib/principles/controllers/open_correction.rb +3 -3
  20. data/lib/principles/data/command-steps.json +4 -4
  21. data/lib/principles/data/repository.rb +4 -4
  22. data/lib/principles/data/running_version.rb +1 -1
  23. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  24. data/lib/principles/invocation_options.rb +4 -4
  25. data/lib/principles/models/acknowledgement.rb +1 -27
  26. data/lib/principles/models/acknowledgement_left_as_printed.rb +2 -1
  27. data/lib/principles/models/acknowledgement_placeholders.rb +48 -0
  28. data/lib/principles/models/assessment_answer.rb +2 -2
  29. data/lib/principles/models/assessment_left_as_printed.rb +1 -1
  30. data/lib/principles/models/audit.rb +1 -1
  31. data/lib/principles/models/audit_records.rb +1 -1
  32. data/lib/principles/models/candidate_inventory.rb +1 -1
  33. data/lib/principles/models/disposition.rb +12 -76
  34. data/lib/principles/models/disposition_placeholders.rb +48 -0
  35. data/lib/principles/models/disposition_text_field.rb +41 -0
  36. data/lib/principles/models/evidence_item.rb +1 -1
  37. data/lib/principles/models/fix_only_fields.rb +4 -3
  38. data/lib/principles/models/located_text.rb +19 -11
  39. data/lib/principles/models/member_assessments.rb +11 -4
  40. data/lib/principles/models/member_file.rb +9 -12
  41. data/lib/principles/models/member_mapping_run.rb +1 -1
  42. data/lib/principles/models/member_repair_moves.rb +20 -4
  43. data/lib/principles/models/member_snapshots.rb +10 -10
  44. data/lib/principles/models/members_sharing_lines.rb +1 -1
  45. data/lib/principles/models/misspelt_member_id.rb +9 -3
  46. data/lib/principles/models/named_placeholder.rb +32 -0
  47. data/lib/principles/models/other_templates_placeholders.rb +25 -6
  48. data/lib/principles/models/principle_history.rb +4 -3
  49. data/lib/principles/models/project.rb +7 -13
  50. data/lib/principles/models/project_at_commit.rb +70 -0
  51. data/lib/principles/models/project_history.rb +10 -52
  52. data/lib/principles/models/sent_answer.rb +4 -3
  53. data/lib/principles/models/template_placeholders.rb +22 -7
  54. data/lib/principles/models/text_size.rb +11 -3
  55. data/lib/principles/models/unfinished_field.rb +34 -0
  56. data/lib/principles/start_audit_options.rb +10 -2
  57. data/lib/principles/version.rb +2 -2
  58. data/lib/principles/views/acknowledged_result.rb +59 -0
  59. data/lib/principles/views/acknowledgement_result.rb +32 -42
  60. data/lib/principles/views/answer_in_a_file.rb +53 -0
  61. data/lib/principles/views/assessed_members.rb +4 -2
  62. data/lib/principles/views/audit_result.rb +3 -1
  63. data/lib/principles/views/context_parts.rb +1 -1
  64. data/lib/principles/views/correction_request.rb +19 -13
  65. data/lib/principles/views/member_repairs.rb +21 -5
  66. data/lib/principles/views/meta_principle_result.rb +26 -5
  67. data/lib/principles/views/parts_index_result.rb +8 -6
  68. data/lib/principles/views/principle_read_result.rb +2 -2
  69. data/lib/principles/views/problem_lines.rb +8 -3
  70. data/lib/principles/views/problem_result.rb +11 -0
  71. data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +6 -0
  72. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
  73. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-check.md +4 -3
  74. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +4 -3
  75. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +7 -8
  76. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +4 -3
  77. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member-check.md +4 -3
  78. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +4 -3
  79. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +13 -12
  80. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +5 -5
  81. data/lib/principles/views/prompts/start-a-session/act-on-the-changed-principles.md +2 -0
  82. data/lib/principles/views/prompts.rb +7 -4
  83. metadata +13 -2
@@ -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
@@ -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
@@ -1,8 +1,8 @@
1
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`.
2
+ reports a member changed, unassessed, locator_lost or unavailable. `--part PART`, repeatable, prints parts: 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,
@@ -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.
@@ -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.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: principles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sidu Ponnappa
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-11-20 00:00:00.000000000 Z
10
+ date: 2026-11-22 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: |
13
13
  A harness configuration framework that keeps every part of your Claude Code agent's harness in alignment.
@@ -42,6 +42,7 @@ files:
42
42
  - lib/principles/controllers/assessment.rb
43
43
  - lib/principles/controllers/audit.rb
44
44
  - lib/principles/controllers/audit_completion.rb
45
+ - lib/principles/controllers/broken_member_repairs.rb
45
46
  - lib/principles/controllers/command.rb
46
47
  - lib/principles/controllers/correction.rb
47
48
  - lib/principles/controllers/first_audit_brief.rb
@@ -114,6 +115,7 @@ files:
114
115
  - lib/principles/models/acknowledged_check.rb
115
116
  - lib/principles/models/acknowledgement.rb
116
117
  - lib/principles/models/acknowledgement_left_as_printed.rb
118
+ - lib/principles/models/acknowledgement_placeholders.rb
117
119
  - lib/principles/models/acknowledgement_refusal.rb
118
120
  - lib/principles/models/acknowledgements.rb
119
121
  - lib/principles/models/acknowledgements_across.rb
@@ -154,6 +156,8 @@ files:
154
156
  - lib/principles/models/declared_map_changes.rb
155
157
  - lib/principles/models/declared_member_removals.rb
156
158
  - lib/principles/models/disposition.rb
159
+ - lib/principles/models/disposition_placeholders.rb
160
+ - lib/principles/models/disposition_text_field.rb
157
161
  - lib/principles/models/entry_file.rb
158
162
  - lib/principles/models/entry_files.rb
159
163
  - lib/principles/models/evidence_item.rb
@@ -217,6 +221,7 @@ files:
217
221
  - lib/principles/models/meta_principle.rb
218
222
  - lib/principles/models/missing_files.rb
219
223
  - lib/principles/models/misspelt_member_id.rb
224
+ - lib/principles/models/named_placeholder.rb
220
225
  - lib/principles/models/new_findings.rb
221
226
  - lib/principles/models/open_correction.rb
222
227
  - lib/principles/models/open_finding.rb
@@ -248,6 +253,7 @@ files:
248
253
  - lib/principles/models/prior_findings.rb
249
254
  - lib/principles/models/problem_report.rb
250
255
  - lib/principles/models/project.rb
256
+ - lib/principles/models/project_at_commit.rb
251
257
  - lib/principles/models/project_history.rb
252
258
  - lib/principles/models/quoted_change.rb
253
259
  - lib/principles/models/recent_decision.rb
@@ -280,6 +286,7 @@ files:
280
286
  - lib/principles/models/unchecked_members.rb
281
287
  - lib/principles/models/uncommitted_files.rb
282
288
  - lib/principles/models/uncommitted_outside_the_map.rb
289
+ - lib/principles/models/unfinished_field.rb
283
290
  - lib/principles/models/unknown_principle.rb
284
291
  - lib/principles/models/waits_on.rb
285
292
  - lib/principles/models/write_up_opening.rb
@@ -291,11 +298,13 @@ files:
291
298
  - lib/principles/start_audit_options.rb
292
299
  - lib/principles/supported_ruby.rb
293
300
  - lib/principles/version.rb
301
+ - lib/principles/views/acknowledged_result.rb
294
302
  - lib/principles/views/acknowledged_since_last_audit.rb
295
303
  - lib/principles/views/acknowledgement_result.rb
296
304
  - lib/principles/views/activation_in_hand.rb
297
305
  - lib/principles/views/added_member.rb
298
306
  - lib/principles/views/answer_head.rb
307
+ - lib/principles/views/answer_in_a_file.rb
299
308
  - lib/principles/views/answered_request.rb
300
309
  - lib/principles/views/assessed_members.rb
301
310
  - lib/principles/views/assessment_request.rb
@@ -361,6 +370,7 @@ files:
361
370
  - lib/principles/views/prompts/acknowledge-a-change/run-the-check-and-report-it-passing.md
362
371
  - lib/principles/views/prompts/acknowledge-a-change/say-whether-each-change-keeps-its-meaning.md
363
372
  - lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md
373
+ - lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md
364
374
  - lib/principles/views/prompts/answer-any-judgement-request/what-a-self-audit-cannot-show.md
365
375
  - lib/principles/views/prompts/assess-every-member/answer-guide.json
366
376
  - lib/principles/views/prompts/assess-every-member/assess-each-member-and-the-set.md
@@ -467,6 +477,7 @@ files:
467
477
  - lib/principles/views/prompts/set-principles-up/what-the-passage-presumes.md
468
478
  - lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md
469
479
  - lib/principles/views/prompts/start-a-session/act-on-the-changed-members.md
480
+ - lib/principles/views/prompts/start-a-session/act-on-the-changed-principles.md
470
481
  - lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md
471
482
  - lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md
472
483
  - lib/principles/views/prompts/start-a-session/see-the-earlier-line.md