principles 0.0.9 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +3 -3
- data/lib/principles/controllers/acknowledgement.rb +11 -4
- data/lib/principles/controllers/acknowledgements.rb +4 -4
- data/lib/principles/controllers/assessment.rb +1 -1
- data/lib/principles/controllers/audit.rb +2 -1
- data/lib/principles/controllers/broken_member_repairs.rb +60 -0
- data/lib/principles/controllers/command.rb +8 -30
- data/lib/principles/controllers/correction.rb +7 -5
- data/lib/principles/controllers/full_audit_request.rb +32 -16
- data/lib/principles/controllers/inventory.rb +3 -3
- data/lib/principles/controllers/member_acknowledgement.rb +5 -5
- data/lib/principles/controllers/member_addition.rb +1 -1
- data/lib/principles/controllers/member_entries.rb +1 -1
- data/lib/principles/controllers/member_problems_report.rb +6 -9
- data/lib/principles/controllers/members_to_assess.rb +1 -1
- data/lib/principles/controllers/meta_principle_setup.rb +4 -3
- data/lib/principles/controllers/open_correction.rb +3 -3
- data/lib/principles/data/command-steps.json +4 -4
- data/lib/principles/data/repository.rb +4 -4
- data/lib/principles/data/running_version.rb +1 -1
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/invocation_options.rb +4 -4
- data/lib/principles/models/acknowledgement.rb +1 -27
- data/lib/principles/models/acknowledgement_left_as_printed.rb +2 -1
- data/lib/principles/models/acknowledgement_placeholders.rb +48 -0
- data/lib/principles/models/assessment_answer.rb +2 -2
- data/lib/principles/models/assessment_left_as_printed.rb +1 -1
- data/lib/principles/models/audit.rb +1 -1
- data/lib/principles/models/audit_records.rb +1 -1
- data/lib/principles/models/candidate_inventory.rb +1 -1
- data/lib/principles/models/disposition.rb +12 -76
- data/lib/principles/models/disposition_placeholders.rb +48 -0
- data/lib/principles/models/disposition_text_field.rb +41 -0
- data/lib/principles/models/evidence_item.rb +1 -1
- data/lib/principles/models/findings_left_open.rb +3 -3
- data/lib/principles/models/fix_only_fields.rb +4 -3
- data/lib/principles/models/located_text.rb +19 -11
- data/lib/principles/models/member_assessments.rb +11 -4
- data/lib/principles/models/member_file.rb +9 -12
- data/lib/principles/models/member_mapping_run.rb +1 -1
- data/lib/principles/models/member_repair_moves.rb +20 -4
- data/lib/principles/models/member_snapshots.rb +10 -10
- data/lib/principles/models/members_sharing_lines.rb +1 -1
- data/lib/principles/models/misspelt_member_id.rb +9 -3
- data/lib/principles/models/named_placeholder.rb +32 -0
- data/lib/principles/models/open_finding.rb +0 -4
- data/lib/principles/models/other_templates_placeholders.rb +25 -6
- data/lib/principles/models/principle_history.rb +4 -3
- data/lib/principles/models/project.rb +7 -13
- data/lib/principles/models/project_at_commit.rb +70 -0
- data/lib/principles/models/project_history.rb +10 -52
- data/lib/principles/models/sent_answer.rb +4 -3
- data/lib/principles/models/template_placeholders.rb +22 -7
- data/lib/principles/models/text_size.rb +11 -3
- data/lib/principles/models/unfinished_field.rb +34 -0
- data/lib/principles/start_audit_options.rb +10 -2
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_result.rb +59 -0
- data/lib/principles/views/acknowledgement_result.rb +32 -42
- data/lib/principles/views/answer_in_a_file.rb +53 -0
- data/lib/principles/views/assessed_members.rb +4 -2
- data/lib/principles/views/audit_result.rb +3 -1
- data/lib/principles/views/context_parts.rb +1 -1
- data/lib/principles/views/correction_request.rb +19 -13
- data/lib/principles/views/member_repairs.rb +21 -5
- data/lib/principles/views/meta_principle_result.rb +26 -5
- data/lib/principles/views/open_findings_line.rb +69 -28
- data/lib/principles/views/parts_index_result.rb +8 -6
- data/lib/principles/views/principle_read_result.rb +2 -2
- data/lib/principles/views/problem_lines.rb +22 -27
- data/lib/principles/views/problem_result.rb +11 -0
- data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +6 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-check.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +7 -8
- data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member-check.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +15 -16
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +5 -5
- data/lib/principles/views/prompts/start-a-session/act-on-the-changed-members.md +2 -0
- data/lib/principles/views/prompts/start-a-session/act-on-the-changed-principles.md +2 -0
- data/lib/principles/views/prompts.rb +7 -4
- data/principles.gemspec +2 -2
- metadata +17 -6
- data/lib/principles/views/prompts/start-a-session/run-each-command-above.md +0 -1
- data/lib/principles/views/prompts/start-a-session/start-with-the-principles-skill.md +0 -1
|
@@ -11,8 +11,9 @@ module Principles
|
|
|
11
11
|
module Views
|
|
12
12
|
# list-open-findings --short: the one line a session-start hook puts into the agent's context while any
|
|
13
13
|
# finding is open that someone should raise, and nothing when none is. It states the facts the agent judges
|
|
14
|
-
# from, how many wait on someone named or on no one, whom the oldest of the former waits on and
|
|
15
|
-
# name, then says to raise each that waits on its user, and why, with the command that lists
|
|
14
|
+
# from, how many wait on someone named or on no one, whom the oldest of the former waits on and for how long,
|
|
15
|
+
# and git's user name, then says to raise each that waits on its user, and why, with the command that lists
|
|
16
|
+
# them all.
|
|
16
17
|
class OpenFindingsLine
|
|
17
18
|
# A waits_on longer than this is cut, so the line stays one short line.
|
|
18
19
|
WAITS_ON_LIMIT = 80
|
|
@@ -36,6 +37,44 @@ module Principles
|
|
|
36
37
|
def reply = @source == "startup" ? "first" : "next"
|
|
37
38
|
end
|
|
38
39
|
|
|
40
|
+
# The open findings as the line states them, from the plain hash a controller hands it: how many are open and
|
|
41
|
+
# the oldest of all, which a resumed line names, and how many wait on someone named or on no one, with the
|
|
42
|
+
# oldest of the former.
|
|
43
|
+
class Waiting
|
|
44
|
+
#: (Hash[String, untyped]) -> void
|
|
45
|
+
def initialize(fields)
|
|
46
|
+
@fields = fields
|
|
47
|
+
freeze
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
#: () -> Integer
|
|
51
|
+
def count = @fields.fetch("count")
|
|
52
|
+
|
|
53
|
+
#: () -> Integer
|
|
54
|
+
def days_open = @fields.fetch("days_open")
|
|
55
|
+
|
|
56
|
+
#: () -> Integer
|
|
57
|
+
def named = @fields.fetch("waiting_on_someone_named")
|
|
58
|
+
|
|
59
|
+
#: () -> Integer
|
|
60
|
+
def unnamed = @fields.fetch("waiting_on_no_one_named")
|
|
61
|
+
|
|
62
|
+
#: () -> Integer
|
|
63
|
+
def to_raise = @fields.fetch("to_raise")
|
|
64
|
+
|
|
65
|
+
# Whether the one finding to raise is one waiting on someone named, whose own line names its need.
|
|
66
|
+
#: () -> bool
|
|
67
|
+
def alone? = to_raise == 1 && named == 1
|
|
68
|
+
|
|
69
|
+
# The oldest open finding of all, by principle and finding_id.
|
|
70
|
+
#: () -> Hash[String, untyped]
|
|
71
|
+
def oldest = @fields.slice("principle", "finding_id")
|
|
72
|
+
|
|
73
|
+
# The oldest finding waiting on someone named, by principle, finding_id and waits_on, or nil.
|
|
74
|
+
#: () -> Hash[String, untyped]?
|
|
75
|
+
def oldest_named = @fields["oldest_waiting_on_someone"]
|
|
76
|
+
end
|
|
77
|
+
|
|
39
78
|
#: (Invocation) -> void
|
|
40
79
|
def initialize(invocation)
|
|
41
80
|
@invocation = invocation
|
|
@@ -56,8 +95,10 @@ module Principles
|
|
|
56
95
|
def lines(waiting, not_found = [], source: "startup", user_name: nil)
|
|
57
96
|
start = SessionStart.new(source)
|
|
58
97
|
return [] unless waiting
|
|
59
|
-
|
|
60
|
-
|
|
98
|
+
|
|
99
|
+
waiting = Waiting.new(waiting)
|
|
100
|
+
return [resumed("#{how_long(waiting)} (#{oldest(waiting.oldest)})", not_found)] if start.resumed?
|
|
101
|
+
return [] if waiting.to_raise.zero?
|
|
61
102
|
|
|
62
103
|
[whole(waiting, not_found, start, user_name)]
|
|
63
104
|
end
|
|
@@ -66,14 +107,12 @@ module Principles
|
|
|
66
107
|
|
|
67
108
|
# The line with what to do about the findings, for a context that does not hold it yet: the facts, then the
|
|
68
109
|
# reply that raises them and why, then the command listing them all, which one finding's own need replaces.
|
|
69
|
-
#: (
|
|
110
|
+
#: (Waiting, Array[Hash[String, untyped]], SessionStart, String?) -> String
|
|
70
111
|
def whole(waiting, not_found, start, user_name)
|
|
71
|
-
named = waiting.fetch("waiting_on_someone_named")
|
|
72
|
-
alone = waiting.fetch("to_raise") == 1 && named == 1
|
|
73
112
|
Prompts.text("start-a-session/act-on-the-open-findings",
|
|
74
113
|
facts: "#{waiting_on_someone(waiting)}#{no_one_named(waiting)}#{write_ups(not_found)}" \
|
|
75
|
-
"#{git_user(user_name) unless named.zero?}",
|
|
76
|
-
raise: raise_which(
|
|
114
|
+
"#{git_user(user_name) unless waiting.named.zero?}",
|
|
115
|
+
raise: raise_which(waiting), reply: start.reply, command: waiting.alone? ? "" : " All: #{all}")
|
|
77
116
|
end
|
|
78
117
|
|
|
79
118
|
# The command listing every open finding, a line each.
|
|
@@ -82,34 +121,36 @@ module Principles
|
|
|
82
121
|
|
|
83
122
|
# Which findings the agent raises: the one, if it waits on its user, or each that does, with those waiting on
|
|
84
123
|
# no one, or each when none names anyone.
|
|
85
|
-
#: (
|
|
86
|
-
def raise_which(
|
|
87
|
-
return "If it waits on your user, raise it" if alone
|
|
88
|
-
return "Raise each" if waiting.
|
|
124
|
+
#: (Waiting) -> String
|
|
125
|
+
def raise_which(waiting)
|
|
126
|
+
return "If it waits on your user, raise it" if waiting.alone?
|
|
127
|
+
return "Raise each" if waiting.named.zero?
|
|
89
128
|
|
|
90
|
-
"Raise each that waits on your user#{" or on no one" if waiting.
|
|
129
|
+
"Raise each that waits on your user#{" or on no one" if waiting.unnamed.positive?}"
|
|
91
130
|
end
|
|
92
131
|
|
|
93
132
|
# The sentence naming the oldest finding that waits on someone named, and whom, counting them when several do.
|
|
94
|
-
#: (
|
|
133
|
+
#: (Waiting) -> String
|
|
95
134
|
def waiting_on_someone(waiting)
|
|
96
|
-
oldest = waiting
|
|
135
|
+
oldest = waiting.oldest_named or return ""
|
|
97
136
|
need = need(oldest.fetch("waits_on"))
|
|
98
137
|
need = "#{need}." unless need.end_with?(".")
|
|
99
|
-
named =
|
|
100
|
-
return "Open finding #{
|
|
138
|
+
named = "#{oldest(oldest)}, #{age(oldest.fetch("days_open"))},"
|
|
139
|
+
return "Open finding #{named} waits on: #{need}" if waiting.named == 1
|
|
101
140
|
|
|
102
|
-
"#{counted(named)} on someone; the oldest, #{
|
|
103
|
-
"#{need}"
|
|
141
|
+
"#{counted(waiting.named)} on someone; the oldest, #{named} waits on: #{need}"
|
|
104
142
|
end
|
|
105
143
|
|
|
144
|
+
# How long a finding has gone unraised, in whole days.
|
|
145
|
+
#: (Integer) -> String
|
|
146
|
+
def age(days) = "open #{days} #{days == 1 ? "day" : "days"}"
|
|
147
|
+
|
|
106
148
|
# The sentence counting the findings deferred with no waits_on, after any naming someone.
|
|
107
|
-
#: (
|
|
149
|
+
#: (Waiting) -> String
|
|
108
150
|
def no_one_named(waiting)
|
|
109
|
-
unnamed = waiting.
|
|
151
|
+
unnamed = waiting.unnamed
|
|
110
152
|
return "" if unnamed.zero?
|
|
111
|
-
return " #{unnamed} #{unnamed == 1 ? "waits" : "wait"} on no one named."
|
|
112
|
-
if waiting.fetch("waiting_on_someone_named").positive?
|
|
153
|
+
return " #{unnamed} #{unnamed == 1 ? "waits" : "wait"} on no one named." if waiting.named.positive?
|
|
113
154
|
|
|
114
155
|
"#{counted(unnamed)} on no one named."
|
|
115
156
|
end
|
|
@@ -149,17 +190,17 @@ module Principles
|
|
|
149
190
|
end
|
|
150
191
|
|
|
151
192
|
# How many findings are open and how long the oldest has waited.
|
|
152
|
-
#: (
|
|
153
|
-
def how_long(waiting) = "#{still_open(waiting.
|
|
193
|
+
#: (Waiting) -> String
|
|
194
|
+
def how_long(waiting) = "#{still_open(waiting.count)}#{waited(waiting)}"
|
|
154
195
|
|
|
155
196
|
#: (Integer) -> String
|
|
156
197
|
def still_open(count)
|
|
157
198
|
count == 1 ? "1 audit finding is still open, " : "#{count} audit findings are still open, the oldest "
|
|
158
199
|
end
|
|
159
200
|
|
|
160
|
-
#: (
|
|
201
|
+
#: (Waiting) -> String
|
|
161
202
|
def waited(waiting)
|
|
162
|
-
days = waiting.
|
|
203
|
+
days = waiting.days_open
|
|
163
204
|
return "for less than a day" if days < 1
|
|
164
205
|
|
|
165
206
|
"for #{days} #{days == 1 ? "day" : "days"}"
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
require_relative "assessment_request"
|
|
5
5
|
require_relative "context_parts"
|
|
6
6
|
require_relative "invocation"
|
|
7
|
+
require_relative "answer_in_a_file"
|
|
7
8
|
require_relative "shell_word"
|
|
8
9
|
require_relative "trimmed_instructions_note"
|
|
9
10
|
|
|
@@ -21,18 +22,19 @@ module Principles
|
|
|
21
22
|
|
|
22
23
|
# The index of request, with the note naming the instructions it prints only in part, the command that submits
|
|
23
24
|
# its answer and, as the next step, reading each part, where skipping a carried member's is the agent's choice,
|
|
24
|
-
# then the
|
|
25
|
+
# then filling the answer the template part prints bare, which is too large to carry here, keeping each carried
|
|
26
|
+
# entry, in a file the agent edits with its own tool, since escaping prose for a shell took a script.
|
|
25
27
|
#: (Hash[String, untyped], AssessmentRequest) -> Hash[String, untyped]
|
|
26
28
|
def printed(index, request)
|
|
27
|
-
|
|
28
|
-
options: ["--part", ContextParts::TEMPLATE])
|
|
29
|
+
request_id = index.fetch("request_id")
|
|
29
30
|
read = "Run part_command with each part as printed; skipping a member marked carries_forward is fine, " \
|
|
30
31
|
"unless you judge it again. --as template prints the same answer long, with each slot's help. " \
|
|
31
|
-
"Then fill in the answer
|
|
32
|
+
"Then fill in the answer the response_template part prints"
|
|
33
|
+
fill = AnswerInAFile.new(@invocation).assessment(request.principle_id, request_id:)
|
|
32
34
|
listed(index, request.principle_id)
|
|
33
35
|
.merge(TrimmedInstructionsNote.new(request.trimmed_instruction_fields).to_h)
|
|
34
|
-
.merge("answer_with" => @invocation.submit_answer(
|
|
35
|
-
"next_action" => "#{read}, #{carried(request)}
|
|
36
|
+
.merge("answer_with" => @invocation.submit_answer(request_id),
|
|
37
|
+
"next_action" => "#{read}, #{carried(request)}. #{fill}")
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
private
|
|
@@ -25,7 +25,7 @@ module Principles
|
|
|
25
25
|
# an audit would refuse, with its repair_with commands, from the moves repairs gives it.
|
|
26
26
|
# hook_settings_not_read names each project settings file whose hooks this tool could not read.
|
|
27
27
|
# loaded_files lists each file the members load once, with the total of those loading at session start.
|
|
28
|
-
#: (PrintedPrinciple, repairs: Hash[String, Array[
|
|
28
|
+
#: (PrintedPrinciple, repairs: Hash[String, Array[MemberRepairs::Move]],
|
|
29
29
|
#| ?hook_settings_not_read: Array[Hash[String, String]], ?loaded_files: Hash[String, untyped])
|
|
30
30
|
#| -> Hash[String, untyped]
|
|
31
31
|
def shown(principle, repairs:, hook_settings_not_read: [], loaded_files: {})
|
|
@@ -87,7 +87,7 @@ module Principles
|
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
# member, with its repairs when repairs names it.
|
|
90
|
-
#: (String, Hash[String, untyped], Hash[String, Array[
|
|
90
|
+
#: (String, Hash[String, untyped], Hash[String, Array[MemberRepairs::Move]]) -> Hash[String, untyped]
|
|
91
91
|
def repaired(id, member, repairs)
|
|
92
92
|
MemberRepairs.new(@invocation).beside(id, member, repairs[member.fetch("id")])
|
|
93
93
|
end
|
|
@@ -44,41 +44,36 @@ module Principles
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# short's lines for a session-start hook: on stdout, one line for each principle with a changed member an
|
|
47
|
-
# audit or acknowledgement assessed,
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
stdout = session_start_lines(changed:, skill:)
|
|
54
|
-
Lines.new(stdout: stdout.map { "#{it}\n" }.join, stderr: short.stderr, status: short.status)
|
|
47
|
+
# audit or acknowledgement assessed, as session_start_lines says, from changed, in place of the rows and
|
|
48
|
+
# never-assessed counts, which an always-loaded carrier cannot afford; stderr and the status kept.
|
|
49
|
+
#: (Lines, changed: Hash[String, Integer]) -> Lines
|
|
50
|
+
def at_session_start(short, changed:)
|
|
51
|
+
Lines.new(stdout: session_start_lines(changed:).map { "#{it}\n" }.join, stderr: short.stderr,
|
|
52
|
+
status: short.status)
|
|
55
53
|
end
|
|
56
54
|
|
|
57
|
-
# at_session_start's stdout
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
# at_session_start's stdout: for one principle with changed audited members, a line saying how many, why that
|
|
56
|
+
# matters, to act before the user's task, and the command whose output offers acknowledging them or auditing
|
|
57
|
+
# again; for several, one line counting them, whose command lists each, so the line does not grow with their
|
|
58
|
+
# count. Its command leaves out --project, as the hook's own commands do, since a session runs in its project.
|
|
59
|
+
#: (changed: Hash[String, Integer]) -> Array[String]
|
|
60
|
+
def session_start_lines(changed:)
|
|
61
|
+
return changed.map { |id, count| changed_line(id, count) } if changed.size <= 1
|
|
62
|
+
|
|
63
|
+
[Prompts.text("start-a-session/act-on-the-changed-principles",
|
|
64
|
+
count: changed.size.to_s,
|
|
65
|
+
command: @invocation.without_project.in_project("list-member-problems", options: ["--short"]))]
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
private
|
|
67
69
|
|
|
68
|
-
#
|
|
69
|
-
# commands those lines print.
|
|
70
|
-
#: (bool) -> String
|
|
71
|
-
def where_to_start(skill)
|
|
72
|
-
return Prompts.text("start-a-session/start-with-the-principles-skill") if skill
|
|
73
|
-
|
|
74
|
-
Prompts.text("start-a-session/run-each-command-above")
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# The session-start line counting principle id's changed audited members, with the command that lists them.
|
|
70
|
+
# The session-start line on principle id's count of changed audited members.
|
|
78
71
|
#: (String, Integer) -> String
|
|
79
72
|
def changed_line(id, count)
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
Prompts.text("start-a-session/act-on-the-changed-members",
|
|
74
|
+
members: "#{count} audited member#{"s" unless count == 1} of #{VisibleText.new(id)}",
|
|
75
|
+
them: count == 1 ? "it" : "them",
|
|
76
|
+
command: @invocation.without_project.in_project("list-member-problems", id))
|
|
82
77
|
end
|
|
83
78
|
|
|
84
79
|
# The line counting principle id's members no audit has assessed, which a reader tells from a member's row by
|
|
@@ -54,6 +54,17 @@ module Principles
|
|
|
54
54
|
[report.merge("next_action" => action), commands]
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
# report, with each member's history leaving out its commits unless history, which an agent asks for with
|
|
58
|
+
# --history: the rest says what changed and what clears it.
|
|
59
|
+
#: (Hash[String, untyped], history: bool) -> Hash[String, untyped]
|
|
60
|
+
def listed(report, history:)
|
|
61
|
+
return report if history || !report.key?("members")
|
|
62
|
+
|
|
63
|
+
report.merge("members" => report.fetch("members").map do |member|
|
|
64
|
+
member.key?("history") ? member.merge("history" => member.fetch("history").except("commits")) : member
|
|
65
|
+
end)
|
|
66
|
+
end
|
|
67
|
+
|
|
57
68
|
# For each principle with members no baseline holds, what gives them one: outside git a completed audit,
|
|
58
69
|
# and in git committing the files no_baseline_files names.
|
|
59
70
|
#: (Hash[String, untyped], Hash[String, Array[String]]) -> Array[MembersWithNoBaseline]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Save the answer alone in a file outside the project, such as under $TMPDIR: %{save} > FILE
|
|
2
|
+
|
|
3
|
+
Fill %{what} with your own file-edit tool, not a shell heredoc; JSON escapes only a double quote, a backslash and a line
|
|
4
|
+
break, as \", \\ and \n, never an apostrophe.
|
|
5
|
+
|
|
6
|
+
Submit that file: %{answer_with}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"deferred": {
|
|
13
13
|
"action": "deferred",
|
|
14
|
-
"reason": "
|
|
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" },
|
|
@@ -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
|
-
|
|
17
|
-
instead. This tool never acts on the near miss: check
|
|
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
|
-
|
|
9
|
-
instead. This tool never acts on the near miss: check
|
|
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.
|
|
@@ -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
|
|
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
|
-
|
|
20
|
-
|
|
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
|
|
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
|
|
60
|
-
|
|
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
|
-
|
|
16
|
-
instead. This tool never acts on the near miss: check
|
|
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
|
-
|
|
10
|
-
instead. This tool never acts on the near miss: check
|
|
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
|
-
|
|
6
|
-
instead. This tool never acts on the near miss: check
|
|
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.
|
|
@@ -4,22 +4,21 @@ nothing more, so a shell that leaves stdin open is not kept waiting; it reads no
|
|
|
4
4
|
0, since a host adds a SessionStart hook's output to the context only on 0, and shows the user an error on any other
|
|
5
5
|
status. In a project with no maps it prints nothing.
|
|
6
6
|
|
|
7
|
-
Otherwise each line it prints starts `principles:`.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`list-member-problems
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for the session's start, and short on resume, whose conversation holds the whole line already.
|
|
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, when one principle has a member an audit assessed that changed since, comes a line counting them,
|
|
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; 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.
|
|
23
22
|
|
|
24
23
|
When the maps or members cannot be read, as `list-member-problems` would refuse, it prints instead the refusal's code
|
|
25
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
|
|
3
|
-
`text` and `lines_in_text`, an instruction or `response_template`
|
|
4
|
-
--part members/ID`
|
|
5
|
-
`carries_forward` a member,
|
|
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.
|
|
@@ -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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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.
|
data/principles.gemspec
CHANGED
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
# Rakefile. Loaded from the checkout, as Bundler does, it is RELEASE, so Gemfile.lock does not change with
|
|
9
9
|
# every commit.
|
|
10
10
|
spec.version = Principles::BUILT_VERSION || Principles::RELEASE
|
|
11
|
-
spec.summary = "Tighter harness, longer
|
|
11
|
+
spec.summary = "Tighter harness, longer running agents: trust the principles, loosen the supervision"
|
|
12
12
|
spec.description = <<~TEXT
|
|
13
13
|
A harness configuration framework that keeps every part of your Claude Code agent's harness in alignment.
|
|
14
14
|
Name the principles your CLAUDE.md files, rules, skills, subagents and hooks encode, and map every place
|
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
move with it, and walks your agent through bringing them back into line, recording anything still to fix.
|
|
17
17
|
It never edits your harness and calls no model: it keeps the books deterministically.
|
|
18
18
|
Ruby 3.4, with no runtime gem dependencies.
|
|
19
|
-
Codex
|
|
19
|
+
Built for Claude Code. Codex is partly supported, with full support coming soon, and Pi after that.
|
|
20
20
|
TEXT
|
|
21
21
|
spec.license = "Apache-2.0"
|
|
22
22
|
spec.authors = ["Sidu Ponnappa"]
|