A section registered before the controller's terminal took over, or set there, is replaced or removed by a proposal the operator approves
It could not be changed at all: propose refused a name set there and never replaced one. The ask now says plainly that it replaces or removes the registered section and binds its text's digest; on Approve every node renders the new text in the place of the old (a removal leaves it out); a replacement keeps the section's own heading form (issue 340 note 14). Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -637,6 +637,14 @@ func mergeSettings(a, b map[string]any) map[string]any {
|
||||
// registered for the mesh, then those for this node.
|
||||
func InstructionSections(c Config) string {
|
||||
var b strings.Builder
|
||||
// The approved sections that replace or remove a registered one, by its name and the digest of its text, and the
|
||||
// proposals already placed where the registered section stood.
|
||||
over, placed := map[string]ApprovedSection{}, map[string]bool{}
|
||||
for _, s := range c.Approved {
|
||||
if s.Over != "" {
|
||||
over[s.Name+"|"+s.Over] = s
|
||||
}
|
||||
}
|
||||
registered := "Registered through the `claude-code` module before that moved to the controller's terminal; change them there, in the module's `instructions` setting."
|
||||
for _, part := range []struct {
|
||||
title, note string
|
||||
@@ -654,14 +662,31 @@ func InstructionSections(c Config) string {
|
||||
}
|
||||
fmt.Fprintf(&b, "\n## %s\n\n%s\n", part.title, part.note)
|
||||
for _, it := range sections {
|
||||
fmt.Fprintf(&b, "\n### %s\n\n%s\n", it.Name, strings.TrimSpace(it.Files[it.Name+".md"]))
|
||||
text := it.Files[it.Name+".md"]
|
||||
if s, ok := over[it.Name+"|"+textDigest(text)]; ok {
|
||||
// What the operator approved over this registered section stands in its place, or leaves it out.
|
||||
placed[s.Proposal] = true
|
||||
if s.Removes {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(&b, "\n### %s\n\n*Replaced on the operator's approval (proposed from %s; approved %s).*\n\n%s\n", it.Name, s.From,
|
||||
s.Approved.UTC().Format("2006-01-02 15:04 UTC"), strings.TrimSpace(s.Text))
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(&b, "\n### %s\n\n%s\n", it.Name, strings.TrimSpace(text))
|
||||
}
|
||||
}
|
||||
if len(c.Approved) > 0 {
|
||||
var approved []ApprovedSection
|
||||
for _, s := range c.Approved {
|
||||
if !s.Removes && !placed[s.Proposal] {
|
||||
approved = append(approved, s)
|
||||
}
|
||||
}
|
||||
if len(approved) > 0 {
|
||||
b.WriteString("\n## Instructions the operator approved\n\nProposed by an agent through the `claude-code` module and " +
|
||||
"approved by the operator on a channel that proves who answered (novox/hq ADR 0274). Changed or removed only the " +
|
||||
"same way: `claude_code_instructions_propose`.\n")
|
||||
for _, s := range c.Approved {
|
||||
for _, s := range approved {
|
||||
fmt.Fprintf(&b, "\n### %s\n\n*Proposed from %s; approved %s.*\n\n%s\n", s.Name, s.From,
|
||||
s.Approved.UTC().Format("2006-01-02 15:04 UTC"), strings.TrimSpace(s.Text))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user