principles 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cf6524aebb33da2c9c9efedba5e43ff14d0514edac930543d9667d696c91819
4
- data.tar.gz: 9692a2e6b1b4aa14d6c6e1eba9929b31e1a9a17678d4e1799152e5a5112c5e28
3
+ metadata.gz: dff6cef8ffe7bf8e4ae196d30990ef04dead3936c9589417f2d855e30537061b
4
+ data.tar.gz: 15f837c78a1764c255d6f3d5d47569dd24715fdd12cd8ea7fb1e3e94be8a53a3
5
5
  SHA512:
6
- metadata.gz: '0399642f807523558f0835997880cc62dacaf348ad14af9538d4ef4ebb24def915c49d56022577daa26523dd0fc9cbc5453be7e2f45ce39ad245582e84773079'
7
- data.tar.gz: ae8d5ba7d7d74c13ccb5f7eb0c604ac4aa48b978121922aa31f28176eaa82be2dd63c450cae37b0a745ee309e6bdda96662a4926d0d86a44af6732ee630f4120
6
+ metadata.gz: 79b6c84811e0e3cab5be0e0ab17cb7197bb269bb40ba6f049779820776f8700d3c7fe09036f361adc4ea6aae46a1abc87403a95522d65cde128c17580d6c022d
7
+ data.tar.gz: a057071b4e8e84c5d22d7582388018e106c044a831a7b604944dd1503e9f03ce3fc0957e467f2b0f8aa5b61ab47406b969cc4b02b7fb73c55c14b3162c9a5a33
data/CHANGELOG.md CHANGED
@@ -13,6 +13,13 @@ The agent's mechanics are the means, never the lead: do not open with "An agent
13
13
 
14
14
  ## Unreleased
15
15
 
16
+ ## [0.1.1] - 2026-11-24
17
+
18
+ ### Changed
19
+
20
+ - **A session starts about four times faster in a project with a long history.** `principles report-at-session-start`, which the session-start hook runs, and `principles list-member-problems` now read the files at each commit through one git process and every map's history in one walk, where they started a git process for each. On a project of 5,235 commits and 14 principles, each took about 3.4 s and now takes under 0.9 s, with the same output.
21
+ - **A first survey proposes principles, not one map per rule, and its follow-up questions come one at a time.** `principles list-candidate-files` now asks the agent to group rules under the intent they serve, split a hub file such as a CI workflow by passage, pair a rule with what enforces it, and map a lone rule as a member rather than a principle. What it asks after the table is a numbered list, the first offering to map every principle at once. The `/principles` skill defines a principle, member, rule, map, audit and finding in the same words.
22
+
16
23
  ## [0.1.0] - 2026-11-23
17
24
 
18
25
  ### Added
@@ -0,0 +1,58 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Principles
5
+ # Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
6
+ module Data
7
+ # Each file's text at a full commit sha, read once and kept frozen, since text at a full sha never changes.
8
+ # Every read goes through one `git cat-file --batch` started on the first, not a git process per file:
9
+ # list-member-problems reads hundreds, and starting each costs more than reading it. git ends it when
10
+ # this tool's end of the pipe closes, on exit or once nothing holds these texts. A name git's line-based batch
11
+ # cannot take, one holding a line break, or one naming anything but a file, such as a folder, is read by itself
12
+ # through `git show`, the reader given.
13
+ class CommittedTexts
14
+ # What git prints before an object it found: its id, type and size. A name it found none for, or more than one,
15
+ # gets a line ending "missing" or "ambiguous" instead, and no object.
16
+ HEADER = /\A\h+ (?<type>[a-z]+) (?<size>\d+)\n\z/ #: Regexp
17
+
18
+ #: (String, ^(String) -> String?) -> void
19
+ def initialize(directory, show)
20
+ @directory = directory
21
+ @show = show
22
+ @texts = {} #: Hash[String, String?]
23
+ @batch = nil #: IO?
24
+ end
25
+
26
+ # The text of name, a full sha, a colon and a path from the project ("<sha>:./<path>"), or nil when that commit
27
+ # does not hold a file there or git cannot be asked.
28
+ #: (String) -> String?
29
+ def text(name)
30
+ return @texts[name] if @texts.key?(name)
31
+
32
+ @texts[name] = name.match?(/[\r\n]/) ? @show.call(name) : read(name)
33
+ end
34
+
35
+ private
36
+
37
+ #: (String) -> String?
38
+ def read(name)
39
+ batch = @batch ||= start
40
+ batch.write("#{name}\n")
41
+ found = HEADER.match(batch.gets.to_s) or return nil
42
+ text = batch.read(found[:size].to_i).to_s
43
+ batch.read(1)
44
+ found[:type] == "blob" ? text.force_encoding("UTF-8").freeze : @show.call(name)
45
+ rescue SystemCallError, IOError
46
+ nil
47
+ end
48
+
49
+ #: () -> IO
50
+ def start
51
+ IO.popen(["git", "-C", @directory, "cat-file", "--batch"], "r+", err: File::NULL).tap do |batch|
52
+ batch.sync = true
53
+ Process.detach(batch.pid)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -10,6 +10,15 @@ module Principles
10
10
  # its full and short sha, subject line, author date and whether it is a root commit ("true" or "false"). The list
11
11
  # and each commit are frozen, and a list asked to be kept is read from git once, a refusal included.
12
12
  class FirstParentLog
13
+ # Each commit's full and short sha, subject line, author date and parents, as git log prints them.
14
+ FORMAT = "%H%x00%h%x00%s%x00%aI%x00%P" #: String
15
+
16
+ # What read_ahead's log starts each commit's full sha with: a byte no sha holds.
17
+ START = "\x01" #: String
18
+
19
+ # A token of read_ahead's log that starts a commit.
20
+ STARTS_A_COMMIT = /\A\x01\h{40}(?:\h{24})?\z/ #: Regexp
21
+
13
22
  #: (GitCommand) -> void
14
23
  def initialize(git)
15
24
  @git = git
@@ -25,24 +34,55 @@ module Principles
25
34
  @kept[[range, paths.dup.freeze]] ||= read(range, paths)
26
35
  end
27
36
 
37
+ # Reads the commits in range, one that always names the same commits, touching each of path_sets in one git log,
38
+ # and keeps each set's as touching keeps it: each log walks the whole history, whatever it lists. A merge counts
39
+ # by its changes from its first parent, as git log --first-parent counts it. When git cannot list them so, none
40
+ # is kept, and touching asks git for each set.
41
+ #: (String, Array[Array[String]]) -> void
42
+ def read_ahead(range, path_sets)
43
+ output, ok = @git.run(["log", "--first-parent", "--diff-merges=first-parent", "--no-renames", "--relative",
44
+ "--name-only", "-z", "--format=#{START}#{FORMAT}", "--end-of-options", range, "--",
45
+ *path_sets.flatten.uniq])
46
+ return unless ok
47
+
48
+ changed = changes(output)
49
+ path_sets.each do |paths|
50
+ @kept[[range, paths.dup.freeze]] ||=
51
+ changed.filter_map { |commit, names| commit if names.any? { |name| within?(name, paths) } }.freeze
52
+ end
53
+ end
54
+
28
55
  private
29
56
 
30
57
  #: (String, Array[String]) -> Array[Hash[String, String]]
31
58
  def read(range, paths)
32
- output, ok = @git.run(["log", "--first-parent", "--format=%H%x00%h%x00%s%x00%aI%x00%P", "--end-of-options",
33
- range, "--", *paths])
34
- (ok ? commits(output).each(&:freeze) : []).freeze
59
+ output, ok = @git.run(["log", "--first-parent", "--format=#{FORMAT}", "--end-of-options", range, "--", *paths])
60
+ (ok ? output.force_encoding("UTF-8").lines.map { |line| commit(line.chomp) } : []).freeze
35
61
  end
36
62
 
37
- # Each commit in output, the log read asks git for.
38
- #: (String) -> Array[Hash[String, String]]
39
- def commits(output)
40
- output.force_encoding("UTF-8").lines.map do |line|
41
- sha, short, subject, authored_at, parents = line.chomp.split("\0", 5)
42
- { "sha" => sha.to_s, "commit" => short.to_s, "subject" => subject.to_s, "authored_at" => authored_at.to_s,
43
- "root" => parents.to_s.empty?.to_s }
63
+ # Each commit in output, the log read_ahead asks git for, with the names it changed.
64
+ #: (String) -> Array[[Hash[String, String], Array[String]]]
65
+ def changes(output)
66
+ tokens = output.force_encoding("UTF-8").split("\0")
67
+ tokens.slice_before { |token| STARTS_A_COMMIT.match?(token) }.map do |fields|
68
+ names = fields.drop(5).map { |name| name.delete_prefix("\n") }.reject(&:empty?)
69
+ [commit(fields.first(5).join("\0").delete_prefix(START)), names]
44
70
  end
45
71
  end
72
+
73
+ # Whether name is one of paths, or lies in one of them, as git reads a literal pathspec.
74
+ #: (String, Array[String]) -> bool
75
+ def within?(name, paths)
76
+ paths.any? { |path| name == path || name.start_with?("#{path.delete_suffix("/")}/") }
77
+ end
78
+
79
+ # One commit as FORMAT prints it, frozen.
80
+ #: (String) -> Hash[String, String]
81
+ def commit(line)
82
+ sha, short, subject, authored_at, parents = line.split("\0", 5)
83
+ { "sha" => sha.to_s, "commit" => short.to_s, "subject" => subject.to_s, "authored_at" => authored_at.to_s,
84
+ "root" => parents.to_s.empty?.to_s }.freeze
85
+ end
46
86
  end
47
87
  end
48
88
  end
@@ -4,6 +4,8 @@
4
4
  require_relative "git_command"
5
5
  require_relative "verified_head"
6
6
  require_relative "first_parent_log"
7
+ require_relative "working_tree_changes"
8
+ require_relative "committed_texts"
7
9
 
8
10
  module Principles
9
11
  # Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
@@ -24,8 +26,9 @@ module Principles
24
26
  def initialize(root)
25
27
  @root = root
26
28
  @git = GitCommand.new(root) #: GitCommand
27
- @texts = {} #: Hash[[String, String], String?]
29
+ @texts = CommittedTexts.new(root, ->(name) { show(name) }) #: CommittedTexts
28
30
  @log = FirstParentLog.new(@git) #: FirstParentLog
31
+ @changes = WorkingTreeChanges.new(@git) #: WorkingTreeChanges
29
32
  end
30
33
 
31
34
  # A strict permission snapshot; legacy best-effort readers keep their existing behavior.
@@ -100,34 +103,15 @@ module Principles
100
103
  # Which of paths, relative to the project, are untracked or ignored, or differ from HEAD in the index
101
104
  # or the working tree. Before the first commit, every path does.
102
105
  #: (Array[String]) -> Array[String]
103
- def uncommitted(paths)
104
- return [] if paths.empty?
105
- return paths.uniq.sort unless head
106
+ def uncommitted(paths) = @changes.uncommitted(paths, committed: !head.nil?)
106
107
 
107
- changed, = git(["diff", "--name-only", "--relative", "-z", "HEAD", "--", *paths])
108
- untracked, = git(["ls-files", "--others", "-z", "--", *paths])
109
- (changed.split("\0") + untracked.split("\0")).uniq.sort
110
- end
111
-
112
- # Which of paths, relative to the project, git does not track and does not ignore. Before the first
113
- # commit, every path not staged is one.
108
+ # Which of paths, relative to the project, git does not track and does not ignore.
114
109
  #: (Array[String]) -> Array[String]
115
- def untracked_excluding_ignored(paths)
116
- return [] if paths.empty?
117
-
118
- output, = git(["ls-files", "--others", "--exclude-standard", "-z", "--", *paths])
119
- output.split("\0").sort
120
- end
110
+ def untracked_excluding_ignored(paths) = @changes.untracked_excluding_ignored(paths)
121
111
 
122
- # Which of paths, relative to the project, git does not track, ignored or not. Unlike
123
- # untracked_excluding_ignored, it names an ignored file too, since git holds it no more than an untracked one.
112
+ # Which of paths, relative to the project, git does not track, ignored or not.
124
113
  #: (Array[String]) -> Array[String]
125
- def untracked_including_ignored(paths)
126
- return [] if paths.empty?
127
-
128
- output, = git(["ls-files", "--others", "-z", "--", *paths])
129
- output.split("\0").sort
130
- end
114
+ def untracked_including_ignored(paths) = @changes.untracked_including_ignored(paths)
131
115
 
132
116
  # Every path in the project git tracks, as git spells it, sorted, so a path a disk that folds case opens under
133
117
  # another spelling can be told apart; none outside git.
@@ -137,16 +121,10 @@ module Principles
137
121
  ok ? output.force_encoding("UTF-8").split("\0").sort : []
138
122
  end
139
123
 
140
- # Every file in the project that differs from HEAD, is gone since it, or is untracked, sorted. Unlike
141
- # uncommitted, it leaves ignored files out: it is asked about the whole project, where an ignored file is
142
- # one the owner chose to keep out of git, while uncommitted is asked about named members, which an audit
143
- # needs committed. Before the first commit, every file not ignored is one.
124
+ # Every file in the project that differs from HEAD, is gone since it, or is untracked, ignored ones aside,
125
+ # sorted.
144
126
  #: () -> Array[String]
145
- def changed_files
146
- changed, = head ? git(["diff", "--name-only", "--relative", "-z", "HEAD"]) : [""]
147
- untracked, = git(["ls-files", "--others", "--exclude-standard", "-z"])
148
- (changed.split("\0") + untracked.split("\0")).uniq.sort
149
- end
127
+ def changed_files = @changes.changed_files(committed: !head.nil?)
150
128
 
151
129
  # path's text at commit, frozen, or nil when the commit does not hold it. Text at a full sha never changes, so
152
130
  # git is asked for it once; HEAD moves with each commit, so it is asked every time.
@@ -154,7 +132,7 @@ module Principles
154
132
  def text_at(commit, path)
155
133
  return read_text_at(commit, path) unless FULL_SHA.match?(commit)
156
134
 
157
- @texts[[commit, path]] ||= read_text_at(commit, path)
135
+ @texts.text(name_at(commit, path))
158
136
  end
159
137
 
160
138
  # The commits after commit, up to HEAD, that changed any of paths, newest first, each as its short sha and
@@ -181,11 +159,25 @@ module Principles
181
159
  @log.touching(range, paths, kept: [since || up_to, up_to].all? { FULL_SHA.match?(it) })
182
160
  end
183
161
 
162
+ # Reads the commits on up_to's first-parent line, up_to a full sha, touching each of path_sets in one git log,
163
+ # so commits_touching asks git no more for any of them up to it. Any other up_to is not kept, so nothing is read.
164
+ #: (Array[Array[String]], up_to: String) -> void
165
+ def read_ahead(path_sets, up_to:)
166
+ @log.read_ahead(revision(up_to), path_sets) if FULL_SHA.match?(up_to) && !path_sets.empty?
167
+ end
168
+
184
169
  private
185
170
 
186
171
  #: (String, String) -> String?
187
- def read_text_at(commit, path)
188
- text, ok = git(["show", "--end-of-options", "#{revision(commit)}:./#{path}"])
172
+ def read_text_at(commit, path) = show(name_at(commit, path))
173
+
174
+ # How git names path, relative to the project, at commit.
175
+ #: (String, String) -> String
176
+ def name_at(commit, path) = "#{revision(commit)}:./#{path}"
177
+
178
+ #: (String) -> String?
179
+ def show(name)
180
+ text, ok = git(["show", "--end-of-options", name])
189
181
  ok ? text.force_encoding("UTF-8").freeze : nil
190
182
  end
191
183
 
@@ -12,7 +12,7 @@ module Principles
12
12
  class RunningVersion
13
13
  # git archive writes the short sha of the commit it archives here, since .gitattributes marks this file
14
14
  # export-subst; a checkout keeps the placeholder as written.
15
- ARCHIVED_COMMIT = "53dd20cf" #: String
15
+ ARCHIVED_COMMIT = "e72082ee" #: String
16
16
 
17
17
  #: (?String, release: String, ?built: String?, ?archived_commit: String) -> void
18
18
  def initialize(checkout = File.expand_path("../../..", __dir__), release:, built: nil,
@@ -0,0 +1,62 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "git_command"
5
+
6
+ module Principles
7
+ # Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
8
+ module Data
9
+ # Which files in the project's working tree differ from HEAD, or git does not track, as git reports them, with
10
+ # paths relative to the project. Each is asked whether HEAD has a commit at all, since before the first commit
11
+ # nothing is committed and git has no HEAD to diff against.
12
+ class WorkingTreeChanges
13
+ #: (GitCommand) -> void
14
+ def initialize(git)
15
+ @git = git
16
+ freeze
17
+ end
18
+
19
+ # Which of paths are untracked or ignored, or differ from HEAD in the index or the working tree. Before the
20
+ # first commit, every path does.
21
+ #: (Array[String], committed: bool) -> Array[String]
22
+ def uncommitted(paths, committed:)
23
+ return [] if paths.empty?
24
+ return paths.uniq.sort unless committed
25
+
26
+ changed, = @git.run(["diff", "--name-only", "--relative", "-z", "HEAD", "--", *paths])
27
+ untracked, = @git.run(["ls-files", "--others", "-z", "--", *paths])
28
+ (changed.split("\0") + untracked.split("\0")).uniq.sort
29
+ end
30
+
31
+ # Which of paths git does not track and does not ignore. Before the first commit, every path not staged is one.
32
+ #: (Array[String]) -> Array[String]
33
+ def untracked_excluding_ignored(paths)
34
+ return [] if paths.empty?
35
+
36
+ output, = @git.run(["ls-files", "--others", "--exclude-standard", "-z", "--", *paths])
37
+ output.split("\0").sort
38
+ end
39
+
40
+ # Which of paths git does not track, ignored or not. Unlike untracked_excluding_ignored, it names an ignored
41
+ # file too, since git holds it no more than an untracked one.
42
+ #: (Array[String]) -> Array[String]
43
+ def untracked_including_ignored(paths)
44
+ return [] if paths.empty?
45
+
46
+ output, = @git.run(["ls-files", "--others", "-z", "--", *paths])
47
+ output.split("\0").sort
48
+ end
49
+
50
+ # Every file in the project that differs from HEAD, is gone since it, or is untracked, sorted. Unlike
51
+ # uncommitted, it leaves ignored files out: it is asked about the whole project, where an ignored file is
52
+ # one the owner chose to keep out of git, while uncommitted is asked about named members, which an audit
53
+ # needs committed. Before the first commit, every file not ignored is one.
54
+ #: (committed: bool) -> Array[String]
55
+ def changed_files(committed:)
56
+ changed, = committed ? @git.run(["diff", "--name-only", "--relative", "-z", "HEAD"]) : [""]
57
+ untracked, = @git.run(["ls-files", "--others", "--exclude-standard", "-z"])
58
+ (changed.split("\0") + untracked.split("\0")).uniq.sort
59
+ end
60
+ end
61
+ end
62
+ end
@@ -13,15 +13,26 @@ module Principles
13
13
  # each state.
14
14
  class ProblemReport
15
15
  # What list-member-problems reports for map id, or every map, listing a map it cannot read among them, with the
16
- # project's history, which lets each missing file carry the rename git detects for it.
16
+ # project's history, which lets each missing file carry the rename git detects for it. Every map's history is
17
+ # read in one walk of git's, not one each.
17
18
  #: (Project, String?) -> ProblemReport
18
19
  def self.for(project, id)
19
20
  maps = if id then [MemberProblems.for(project, id)]
20
- else project.principles.ids.map { MemberProblems.for(project, it, listing_all: true) }
21
+ else every_map(project)
21
22
  end
22
23
  new(maps, history: project.history)
23
24
  end
24
25
 
26
+ # Each map's problems, its history read ahead at the files PrincipleHistory walks for a map, under the folder's
27
+ # name now and its earlier one.
28
+ #: (Project) -> Array[MemberProblems]
29
+ def self.every_map(project)
30
+ ids = project.principles.ids
31
+ project.history.read_ahead(ids.map { [project.principles.file(it), project.principles.earlier_file(it)] })
32
+ ids.map { MemberProblems.for(project, it, listing_all: true) }
33
+ end
34
+ private_class_method :every_map
35
+
25
36
  # history, when given, lets each missing file carry the rename git detects for it.
26
37
  #: (Array[MemberProblems], ?history: ProjectHistory?) -> void
27
38
  def initialize(maps, history: nil)
@@ -151,6 +151,14 @@ module Principles
151
151
  @repository.commits_touching(through_links(paths), since: since, up_to: head || "HEAD")
152
152
  end
153
153
 
154
+ # Reads the commits on head's first-parent line touching each of path_sets, and the links and files they lead
155
+ # through, in one git log, so commits_touching asks git no more for any of them. Nothing outside git.
156
+ #: (Array[Array[String]]) -> void
157
+ def read_ahead(path_sets)
158
+ up_to = head or return
159
+ @repository.read_ahead(path_sets.map { through_links(it) }, up_to: up_to)
160
+ end
161
+
154
162
  # The commits after commit, up to HEAD, that one move of HEAD brought in, whatever they changed.
155
163
  #: (String) -> CommitsBroughtIn
156
164
  def commits_brought_in(commit)
@@ -3,9 +3,9 @@
3
3
 
4
4
  module Principles
5
5
  # The next production release, as major.minor.patch. A production build is versioned with this alone.
6
- RELEASE = "0.1.0"
6
+ RELEASE = "0.1.1"
7
7
  # The version a built gem prints. `rake build[production]` stamps RELEASE here, in the copy of lib/ it
8
8
  # packages, and `rake build[development]` stamps RELEASE.g<short sha>. A checkout leaves it nil, and
9
9
  # Data::RunningVersion reads the commit this tool runs from instead.
10
- BUILT_VERSION = "0.1.0" #: String?
10
+ BUILT_VERSION = "0.1.1" #: String?
11
11
  end
@@ -111,18 +111,24 @@ module Principles
111
111
  "To add a member to an existing principle: #{add}\nTo map a distinct principle: #{create}"
112
112
  end
113
113
 
114
- # The survey, leaving out files possibly test data, and when outlines were cut or left out how to read them, then
115
- # one item per list to ask the owner about after the table.
114
+ # The survey and how rules group into principles, leaving out files possibly test data, and when outlines were cut
115
+ # or left out how to read them, then what to ask after the table, in order: the choice, where else guidance is
116
+ # kept, and the owner about each list that names a file.
116
117
  #: (Found, survey: String, choice: String) -> String
117
118
  def principle_question(found, survey:, choice:)
118
119
  owner_asks = found.owner_asks
119
- asks = owner_asks.map { |key, paths| "- #{owner_ask(key, named: inline(paths))}" }
120
- [survey, *left_out_of_the_survey(owner_asks),
121
- *budget_notes(found),
122
- choice,
123
- Prompts.text("find-a-principle-to-map/ask-about-other-guidance-search-paths"),
124
- *([Prompts.text("find-a-principle-to-map/ask-the-owner-after-the-table"), *asks].join("\n") if asks.any?)]
125
- .join("\n\n")
120
+ owner = Prompts.text("find-a-principle-to-map/ask-the-owner")
121
+ asks = [choice, Prompts.text("find-a-principle-to-map/ask-about-other-guidance-search-paths"),
122
+ *owner_asks.map { |key, paths| "#{owner} #{owner_ask(key, named: inline(paths))}" }]
123
+ [survey, Prompts.text("find-a-principle-to-map/group-rules-into-principles"),
124
+ *left_out_of_the_survey(owner_asks), *budget_notes(found), in_order(asks)].join("\n\n")
125
+ end
126
+
127
+ # asks as one numbered list, after the line saying to ask them in that order once the table is shown.
128
+ #: (Array[String]) -> String
129
+ def in_order(asks)
130
+ [Prompts.text("find-a-principle-to-map/ask-in-this-order-after-the-table"),
131
+ *asks.each_with_index.map { |ask, index| "#{index + 1}. #{ask}" }].join("\n")
126
132
  end
127
133
 
128
134
  # How to read what the budget cut: a cut section back by its lines, and a file whose outline was left out.
@@ -1,4 +1,4 @@
1
- After the table, ask where else this repository keeps guidance agents follow, including other harness folders,
1
+ Ask where else this repository keeps guidance agents follow, including other harness folders,
2
2
  linked documents, templates and executable checks. You judge which files carry principles; this inventory does not
3
3
  establish that a host loads them. To include a location in a read-only survey now, repeat --also with a quoted
4
4
  root-relative glob. This option does not record the location for later surveys.
@@ -0,0 +1 @@
1
+ Ask the project's owner
@@ -1,2 +1,2 @@
1
- After the table, ask the user which principle to map first. Give it a lower-kebab-case id, and describe it in one
2
- sentence of your own.
1
+ Ask the user which principle to map first, or whether to map them all. Give each a lower-kebab-case id, and describe
2
+ it in one sentence of your own.
@@ -1,2 +1,3 @@
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
+ Ask which existing principle to extend with add-member, or which distinct principle to map with create-principle, or
2
+ whether to map them all. For a new map, choose a lower-kebab-case id and describe what the principle is and why it
3
+ matters.
@@ -1,9 +1,9 @@
1
- Survey this project's principles: the rules that several pieces of its agent guidance reinforce together. Read
1
+ Survey this project's principles: the intents that several pieces of its agent guidance carry together. Read
2
2
  each listed Markdown file's outline, description and opening line printed here, not the files themselves.
3
3
  For a selected non-Markdown file listed by path and size, inspect that file only if needed to judge the rule it
4
4
  enforces; listing it does not show its contents. Show the user one
5
5
  table, with a row for each principle: a name of a word or two, a one-line description, and the files and sections
6
- that carry it. Members can also be rules, skills, hooks, reminders, scripts, data files or build checks anywhere in
6
+ that carry it. Members can also be rule files, skills, hooks, reminders, scripts, data files or build checks anywhere in
7
7
  the project; inventory.scope states what this survey covers. Ask nothing and write nothing until the table is shown. If
8
8
  nothing here reinforces a principle, say so and stop.
9
9
 
@@ -1,9 +1,9 @@
1
1
  Survey this project's principles using each listed Markdown file's outline, description and opening line printed here,
2
2
  not the files themselves. For a selected non-Markdown file listed by path and size, inspect that file only if needed
3
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
4
+ Compare each principle you found with the id and description in mapped_principles: is it a facet of
5
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
6
+ A row with a refusal has no readable description: resolve its repair before deciding a principle is distinct. You judge; do not create
7
7
  a separate map for each wording or file. Show the user one table of principles, each with its description,
8
8
  carrying files and sections, and the existing map it belongs to or why it is distinct.
9
9
  Ask nothing and write nothing until the table is shown. If nothing here reinforces a principle, say so and stop.
@@ -0,0 +1,3 @@
1
+ Group rules under the intent they serve, each place that states or enforces one a member of that principle: split a
2
+ hub file, such as a CI workflow, by passage; pair a rule's statement with what enforces it, such as a hook or a check;
3
+ and map a lone rule as a member of the principle it serves, not as a principle.
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sidu Ponnappa
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-11-22 00:00:00.000000000 Z
10
+ date: 2026-11-24 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.
@@ -70,6 +70,7 @@ files:
70
70
  - lib/principles/data/candidate_files_found.rb
71
71
  - lib/principles/data/command-steps.json
72
72
  - lib/principles/data/command_steps_file.rb
73
+ - lib/principles/data/committed_texts.rb
73
74
  - lib/principles/data/committed_tree.rb
74
75
  - lib/principles/data/expected_type.rb
75
76
  - lib/principles/data/first_parent_log.rb
@@ -107,6 +108,7 @@ files:
107
108
  - lib/principles/data/schemas/member-map-history.schema.json
108
109
  - lib/principles/data/schemas/member-map.schema.json
109
110
  - lib/principles/data/verified_head.rb
111
+ - lib/principles/data/working_tree_changes.rb
110
112
  - lib/principles/error.rb
111
113
  - lib/principles/failure_refusal.rb
112
114
  - lib/principles/invocation_options.rb
@@ -419,11 +421,13 @@ files:
419
421
  - lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md
420
422
  - lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md
421
423
  - lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md
422
- - lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-after-the-table.md
424
+ - lib/principles/views/prompts/find-a-principle-to-map/ask-in-this-order-after-the-table.md
425
+ - lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner.md
423
426
  - lib/principles/views/prompts/find-a-principle-to-map/ask-which-principle-to-map.md
424
427
  - lib/principles/views/prompts/find-a-principle-to-map/choose-an-existing-or-new-principle.md
425
428
  - lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md
426
429
  - lib/principles/views/prompts/find-a-principle-to-map/compare-with-mapped-principles.md
430
+ - lib/principles/views/prompts/find-a-principle-to-map/group-rules-into-principles.md
427
431
  - lib/principles/views/prompts/find-a-principle-to-map/leave-test-data-out-of-the-survey.md
428
432
  - lib/principles/views/prompts/find-a-principle-to-map/owner-ask-ignored-folders.md
429
433
  - lib/principles/views/prompts/find-a-principle-to-map/owner-ask-ignored.md
@@ -1 +0,0 @@
1
- After the table, ask the project's owner: