principles 0.1.3 → 0.1.5
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 +151 -1
- data/README.md +10 -6
- data/exe/principles +1 -1
- data/lib/principles/cli.rb +9 -10
- data/lib/principles/command_line.rb +15 -6
- data/lib/principles/command_routes.rb +18 -2
- data/lib/principles/controllers/acknowledgement.rb +19 -4
- data/lib/principles/controllers/acknowledgements.rb +43 -12
- data/lib/principles/controllers/after_commit_report.rb +15 -2
- data/lib/principles/controllers/assessment.rb +7 -3
- data/lib/principles/controllers/audit.rb +17 -8
- data/lib/principles/controllers/audit_completion.rb +34 -9
- data/lib/principles/controllers/carrier_edit_report.rb +40 -0
- data/lib/principles/controllers/carrier_practices.rb +26 -0
- data/lib/principles/controllers/command.rb +36 -5
- data/lib/principles/controllers/context_budget.rb +61 -0
- data/lib/principles/controllers/correction.rb +15 -5
- data/lib/principles/controllers/full_audit_request.rb +38 -42
- data/lib/principles/controllers/inventory.rb +78 -71
- data/lib/principles/controllers/last_record_notice_beside.rb +51 -0
- data/lib/principles/controllers/member_addition.rb +20 -5
- data/lib/principles/controllers/member_entries.rb +50 -39
- data/lib/principles/controllers/member_entry_changes.rb +71 -0
- data/lib/principles/controllers/member_problems_report.rb +26 -6
- data/lib/principles/controllers/members_a_commit_changed.rb +14 -5
- data/lib/principles/controllers/members_in_logged_requests.rb +52 -0
- data/lib/principles/controllers/members_to_assess.rb +35 -8
- data/lib/principles/controllers/meta_principle_setup.rb +12 -4
- data/lib/principles/controllers/open_correction.rb +3 -2
- data/lib/principles/controllers/parts_to_read.rb +48 -6
- data/lib/principles/controllers/plugin_member_addition.rb +48 -0
- data/lib/principles/controllers/principle_listing.rb +84 -0
- data/lib/principles/controllers/request_logging.rb +65 -0
- data/lib/principles/controllers/running_tool.rb +55 -15
- data/lib/principles/controllers/session_start_report.rb +26 -2
- data/lib/principles/data/branches_bringing_in.rb +52 -0
- data/lib/principles/data/captured_requests.rb +118 -0
- data/lib/principles/data/carrier_page_markers.rb +38 -0
- data/lib/principles/data/changes_since.rb +56 -0
- data/lib/principles/data/claude_code_home.rb +75 -0
- data/lib/principles/data/command-steps.json +139 -23
- data/lib/principles/data/decoded_leaf.rb +63 -0
- data/lib/principles/data/head_reflog.rb +13 -2
- data/lib/principles/data/kept_line.rb +39 -0
- data/lib/principles/data/known_marketplaces.rb +50 -0
- data/lib/principles/data/logged_request_matches.rb +144 -0
- data/lib/principles/data/logged_request_scan.rb +188 -0
- data/lib/principles/data/map_files.rb +18 -4
- data/lib/principles/data/plugin_folder.rb +85 -0
- data/lib/principles/data/plugin_registry.rb +73 -0
- data/lib/principles/data/principles_store.rb +49 -0
- data/lib/principles/data/project_files.rb +15 -0
- data/lib/principles/data/ran.rb +25 -0
- data/lib/principles/data/raw_request_filter.rb +61 -0
- data/lib/principles/data/repository.rb +29 -27
- data/lib/principles/data/request_logging_folder.rb +135 -0
- data/lib/principles/data/request_shape.rb +33 -0
- data/lib/principles/data/running_version.rb +1 -1
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +16 -1
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +16 -1
- data/lib/principles/data/schemas/assessment-answer.schema.json +8 -0
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +14 -0
- data/lib/principles/data/schemas/member-map.schema.json +12 -1
- data/lib/principles/data/settings_env_keys.rb +26 -0
- data/lib/principles/data/string_counts.rb +39 -0
- data/lib/principles/data/tools_on_path.rb +25 -0
- data/lib/principles/data/user_request_logging_folder.rb +73 -0
- data/lib/principles/invocation_options.rb +5 -3
- data/lib/principles/launch.rb +29 -10
- data/lib/principles/models/acknowledged_check.rb +11 -1
- data/lib/principles/models/acknowledgement.rb +5 -0
- data/lib/principles/models/acknowledgement_refusal.rb +20 -11
- data/lib/principles/models/acknowledgements_to_offer.rb +86 -0
- data/lib/principles/models/after_commit_input.rb +5 -0
- data/lib/principles/models/answer_fields.rb +3 -0
- data/lib/principles/models/assessment_basis.rb +10 -3
- data/lib/principles/models/audit.rb +10 -10
- data/lib/principles/models/audit_record.rb +10 -0
- data/lib/principles/models/audit_records.rb +4 -3
- data/lib/principles/models/audit_start.rb +9 -0
- data/lib/principles/models/authored_locator.rb +33 -0
- data/lib/principles/models/candidate_files.rb +23 -3
- data/lib/principles/models/candidate_outline.rb +18 -125
- data/lib/principles/models/captured_sessions.rb +166 -0
- data/lib/principles/models/carrier_edit_input.rb +56 -0
- data/lib/principles/models/carrier_kind.rb +79 -0
- data/lib/principles/models/carrier_pages_shown.rb +28 -0
- data/lib/principles/models/carved_message_bytes.rb +115 -0
- data/lib/principles/models/cited_files.rb +12 -3
- data/lib/principles/models/context_parts.rb +59 -0
- data/lib/principles/models/decided_prior_findings.rb +5 -0
- data/lib/principles/models/declared_map_changes.rb +22 -13
- data/lib/principles/models/disposition.rb +37 -6
- data/lib/principles/models/disposition_placeholders.rb +12 -0
- data/lib/principles/models/disposition_text_field.rb +4 -0
- data/lib/principles/models/dropped_thinking.rb +73 -0
- data/lib/principles/models/feature.rb +54 -0
- data/lib/principles/models/finding_outcomes.rb +55 -0
- data/lib/principles/models/findings_left_open.rb +9 -11
- data/lib/principles/models/head_moves.rb +27 -10
- data/lib/principles/models/installed_component.rb +55 -0
- data/lib/principles/models/installed_plugins.rb +174 -0
- data/lib/principles/models/kept_sessions.rb +34 -0
- data/lib/principles/models/locator.rb +8 -0
- data/lib/principles/models/logged_request_reach.rb +52 -0
- data/lib/principles/models/logged_request_scan_completeness.rb +43 -0
- data/lib/principles/models/map_format_raise.rb +28 -0
- data/lib/principles/models/mapped_baseline.rb +46 -0
- data/lib/principles/models/mapped_principles.rb +2 -1
- data/lib/principles/models/maps_holding_file_whole.rb +42 -0
- data/lib/principles/models/markdown_text.rb +143 -0
- data/lib/principles/models/member.rb +19 -1
- data/lib/principles/models/member_entry.rb +56 -0
- data/lib/principles/models/member_justification.rb +52 -0
- data/lib/principles/models/member_lines.rb +11 -0
- data/lib/principles/models/member_loads.rb +17 -2
- data/lib/principles/models/member_problems.rb +46 -42
- data/lib/principles/models/member_reach.rb +59 -0
- data/lib/principles/models/member_snapshots.rb +34 -4
- data/lib/principles/models/member_text_as_sent.rb +31 -0
- data/lib/principles/models/member_texts.rb +45 -0
- data/lib/principles/models/members_by_part.rb +67 -0
- data/lib/principles/models/members_in_logged_requests.rb +279 -0
- data/lib/principles/models/meta_principle.rb +4 -4
- data/lib/principles/models/missing_files.rb +41 -16
- data/lib/principles/models/nearly_matching_maps.rb +56 -0
- data/lib/principles/models/open_correction.rb +5 -0
- data/lib/principles/models/open_finding.rb +4 -3
- data/lib/principles/models/outline_budget.rb +10 -1
- data/lib/principles/models/outline_item.rb +25 -0
- data/lib/principles/models/outline_section.rb +15 -4
- data/lib/principles/models/part_named.rb +16 -2
- data/lib/principles/models/part_token_estimates.rb +60 -0
- data/lib/principles/models/plugin_component.rb +37 -0
- data/lib/principles/models/plugin_enabled_in_project_settings.rb +61 -0
- data/lib/principles/models/plugin_install.rb +33 -0
- data/lib/principles/models/plugin_name.rb +23 -0
- data/lib/principles/models/plugin_reference.rb +53 -0
- data/lib/principles/models/principle.rb +7 -4
- data/lib/principles/models/principle_members.rb +22 -0
- data/lib/principles/models/prior_finding_decision.rb +1 -1
- data/lib/principles/models/prior_finding_outcomes.rb +12 -1
- data/lib/principles/models/problem_report.rb +14 -25
- data/lib/principles/models/project.rb +51 -56
- data/lib/principles/models/project_harness.rb +48 -0
- data/lib/principles/models/project_history.rb +19 -5
- data/lib/principles/models/recorded_members.rb +7 -0
- data/lib/principles/models/report_hooks.rb +9 -4
- data/lib/principles/models/request_channel.rb +62 -0
- data/lib/principles/models/request_kind.rb +62 -0
- data/lib/principles/models/request_logging.rb +231 -0
- data/lib/principles/models/request_logging_guard.rb +84 -0
- data/lib/principles/models/request_time.rb +46 -0
- data/lib/principles/models/runs_from.rb +0 -5
- data/lib/principles/models/script_comments.rb +58 -0
- data/lib/principles/models/session_registry.rb +61 -0
- data/lib/principles/models/session_start_input.rb +11 -2
- data/lib/principles/models/session_trend.rb +36 -0
- data/lib/principles/models/stale_request.rb +9 -0
- data/lib/principles/models/turn_opening.rb +83 -0
- data/lib/principles/models/turn_position.rb +43 -0
- data/lib/principles/models/unfixed_part.rb +82 -0
- data/lib/principles/models/unresolved_plugin_members.rb +35 -0
- data/lib/principles/models/user_logged_requests.rb +90 -0
- data/lib/principles/models/user_settings_entries.rb +49 -0
- data/lib/principles/models/whole_file_member_read.rb +48 -0
- data/lib/principles/models/without_prose.rb +20 -0
- data/lib/principles/models/workflow_jobs.rb +92 -0
- data/lib/principles/show_members_in_logged_requests_options.rb +27 -0
- data/lib/principles/show_principle_options.rb +32 -0
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_result.rb +31 -12
- data/lib/principles/views/acknowledgement_result.rb +18 -13
- data/lib/principles/views/acknowledgement_template_alone.rb +55 -0
- data/lib/principles/views/acknowledgements_offered.rb +54 -0
- data/lib/principles/views/added_member.rb +22 -6
- data/lib/principles/views/answer_in_a_file.rb +15 -15
- data/lib/principles/views/assessed_members.rb +19 -8
- data/lib/principles/views/assessment_request.rb +14 -6
- data/lib/principles/views/audit_changes.rb +14 -8
- data/lib/principles/views/audit_findings.rb +34 -0
- data/lib/principles/views/audit_result.rb +26 -24
- data/lib/principles/views/candidate_files_result.rb +1 -1
- data/lib/principles/views/carrier_checks.rb +40 -0
- data/lib/principles/views/carrier_edit_denial.rb +36 -0
- data/lib/principles/views/carrier_practices_page.rb +49 -0
- data/lib/principles/views/completed_audit_findings.rb +33 -0
- data/lib/principles/views/completed_audit_next_step.rb +12 -4
- data/lib/principles/views/consecutive_sections_elsewhere.rb +4 -0
- data/lib/principles/views/context_budget_result.rb +99 -0
- data/lib/principles/views/context_parts.rb +129 -25
- data/lib/principles/views/correction_request.rb +32 -17
- data/lib/principles/views/disposition_template.rb +35 -0
- data/lib/principles/views/first_audit.rb +29 -15
- data/lib/principles/views/first_audit_line.rb +4 -5
- data/lib/principles/views/hook_setup_result.rb +3 -1
- data/lib/principles/views/invocation.rb +14 -5
- data/lib/principles/views/last_record_notice.rb +41 -0
- data/lib/principles/views/lines_shared_with_member.rb +16 -22
- data/lib/principles/views/logged_request_status_meanings.rb +29 -0
- data/lib/principles/views/logged_requests_evidence.rb +84 -0
- data/lib/principles/views/map_added_to.rb +14 -12
- data/lib/principles/views/map_format_raised.rb +28 -0
- data/lib/principles/views/map_result.rb +41 -18
- data/lib/principles/views/maps_needing_members_or_audit.rb +1 -1
- data/lib/principles/views/member_change_since_baseline.rb +4 -0
- data/lib/principles/views/member_row.rb +13 -4
- data/lib/principles/views/member_sets_overlap.rb +31 -0
- data/lib/principles/views/members_a_commit_changed.rb +42 -25
- data/lib/principles/views/members_changed_during_audit.rb +27 -0
- data/lib/principles/views/members_in_logged_requests_result.rb +123 -0
- data/lib/principles/views/members_too_short_to_scan.rb +45 -0
- data/lib/principles/views/members_with_no_baseline.rb +6 -6
- data/lib/principles/views/meta_principle_result.rb +52 -15
- data/lib/principles/views/open_findings_line.rb +31 -92
- data/lib/principles/views/parts_index_result.rb +9 -5
- data/lib/principles/views/principle_read_result.rb +52 -11
- data/lib/principles/views/prior_findings_result.rb +9 -1
- data/lib/principles/views/problem_facts.rb +5 -3
- data/lib/principles/views/problem_lines.rb +54 -6
- data/lib/principles/views/problem_result.rb +7 -15
- data/lib/principles/views/prompts/assess-every-member/ask-whether-a-member-seen-only-as-read-is-loaded.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/ask-whether-each-reason-holds.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +6 -6
- data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-against-the-other-principles.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +9 -8
- data/lib/principles/views/prompts/assess-every-member/read-a-flagged-member-s-text-whole.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-judged-member-s-text-whole.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/turn-on-request-logging-to-see-what-reaches-context.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/weigh-what-reached-the-context.md +7 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +6 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/read-the-carrier-page-before-fixing.md +1 -0
- data/lib/principles/views/prompts/edit-a-carrier/read-the-page-before-the-first-edit.md +2 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +1 -1
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-configuration.md +41 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-scripts.md +35 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-instruction-files.md +37 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-other-text-an-agent-reads.md +38 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-rule-files.md +34 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-skills.md +35 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-subagent-definitions.md +35 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +49 -51
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-name.md +12 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-reason.md +12 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +2 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/every-command-and-how-they-chain.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +32 -32
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
- data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +7 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-logged-requests.md +22 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +2 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +8 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/report-before-carrier-edit.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-audit.md +7 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +8 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/show-carrier-practices.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-context-budget.md +69 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +4 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/show-logged-requests.md +22 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-members-in-logged-requests.md +62 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +13 -10
- data/lib/principles/views/prompts/learn-what-a-command-does/show-principle.md +16 -16
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +27 -27
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +17 -17
- data/lib/principles/views/prompts/learn-what-a-command-does/turn-off-request-logging.md +18 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/turn-on-request-logging.md +44 -0
- data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +3 -2
- data/lib/principles/views/prompts/read-what-reached-the-context/explain-request-logging-to-the-user.md +11 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/explain-user-request-logging-to-the-user.md +10 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/see-whether-members-reach-the-agent.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-a-thread-continuation-holds.md +3 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-absent-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-each-context-budget-line-says.md +4 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-each-member-line-says.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-not-a-carrier-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-present-but-not-loaded-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-present-means.md +1 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-unmeasurable-means.md +2 -0
- data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-audit-asks-to-acknowledge-or-audit-again.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-mapping-commit-asks-for-an-audit.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-pinned-asks-for-an-audit.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/plugin-members-are-still-listed.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members-waiting-on-an-upgrade.md +2 -2
- data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members.md +2 -2
- data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-what-each-needs-before-the-next-commit.md +1 -0
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -0
- data/lib/principles/views/prompts/set-principles-up/ask-to-set-principles-up-after-an-audit.md +1 -0
- data/lib/principles/views/prompts/set-principles-up/entry-file-passage.md +1 -1
- data/lib/principles/views/prompts/set-principles-up/map-the-enabling-line-at-no-edit.md +3 -0
- data/lib/principles/views/prompts/set-principles-up/name-the-step-each-member-lacks.md +2 -2
- data/lib/principles/views/prompts/set-principles-up/place-the-passage-with-the-user.md +4 -2
- data/lib/principles/views/prompts/set-principles-up/what-the-passage-presumes.md +1 -1
- data/lib/principles/views/prompts/set-principles-up/why-set-principles-up.md +1 -0
- data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +2 -1
- data/lib/principles/views/prompts/start-a-session/ask-to-set-principles-up.md +2 -0
- data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +2 -3
- data/lib/principles/views/prompts/start-a-session/name-the-principles-nothing-checks.md +1 -0
- data/lib/principles/views/prompts/start-a-session/raise-the-open-findings-waiting-on-no-one.md +1 -0
- data/lib/principles/views/request_logging_result.rb +108 -0
- data/lib/principles/views/request_part.rb +10 -4
- data/lib/principles/views/request_parts.rb +9 -0
- data/lib/principles/views/set_up_offer_line.rb +43 -0
- data/lib/principles/views/whole_file_elsewhere.rb +30 -0
- metadata +154 -5
- data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +0 -1
- data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-each-one.md +0 -1
- data/lib/principles/views/prompts/set-principles-up/keep-them-held-between-audits.md +0 -2
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
require_relative "logged_request_status_meanings"
|
|
6
|
+
require_relative "members_in_logged_requests_result"
|
|
7
|
+
require_relative "prompts"
|
|
8
|
+
require_relative "request_part"
|
|
9
|
+
|
|
10
|
+
module Principles
|
|
11
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
12
|
+
module Views
|
|
13
|
+
# What a full audit's request prints from the logged requests, so the agent judging each
|
|
14
|
+
# member sees whether its text reached the agent's context: here, while none is captured, the one line saying how
|
|
15
|
+
# to capture them; while git might commit them or a tool the scan runs is missing, why none is read; and else how
|
|
16
|
+
# far each judged member's text reached them.
|
|
17
|
+
class LoggedRequestsEvidence
|
|
18
|
+
# The part this prints, by the name the request prints it under and start-audit --part takes.
|
|
19
|
+
PART = "logged_requests" #: String
|
|
20
|
+
|
|
21
|
+
#: (Invocation) -> void
|
|
22
|
+
def initialize(invocation)
|
|
23
|
+
@invocation = invocation
|
|
24
|
+
freeze
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The request's part saying that no request is captured, and the command that turns capture on.
|
|
28
|
+
#: () -> RequestPart
|
|
29
|
+
def none_captured
|
|
30
|
+
turn_on = @invocation.in_project("turn-on-request-logging")
|
|
31
|
+
fact = Prompts.text("assess-every-member/turn-on-request-logging-to-see-what-reaches-context", turn_on:)
|
|
32
|
+
RequestPart.new(shown: { PART => { "fact" => fact } }, slots: {})
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# The request's part saying how far each judged member's text reached the captured requests, as reach gives it,
|
|
36
|
+
# with how its model turns' positions were told and what a continuation holds, the command that shows where in
|
|
37
|
+
# the requests one member was seen, its key as KEY, what each status means, and the question that asks the agent
|
|
38
|
+
# to weigh it.
|
|
39
|
+
#: (Hash[String, untyped]) -> RequestPart
|
|
40
|
+
def reached(reach)
|
|
41
|
+
detail = @invocation.in_project("show-members-in-logged-requests", options: ["--member", "KEY"])
|
|
42
|
+
weigh = Prompts.text("assess-every-member/weigh-what-reached-the-context")
|
|
43
|
+
shown = reach.merge(asked_about(reach.fetch("seen_only_as_read", [])))
|
|
44
|
+
shown = shown.merge("position_heuristic" => MembersInLoggedRequestsResult::POSITION_HEURISTIC,
|
|
45
|
+
"what_a_continuation_holds" => MembersInLoggedRequestsResult.what_a_continuation_holds,
|
|
46
|
+
"detail_with" => detail, "status_meanings" => LoggedRequestStatusMeanings.new.to_h,
|
|
47
|
+
"weigh" => weigh)
|
|
48
|
+
RequestPart.new(shown: { PART => shown }, slots: {})
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# The member keys in read, each seen only where the agent read, sent or quoted it, under the one question whether
|
|
52
|
+
# the host loads them; nothing while there is none.
|
|
53
|
+
#: (Array[String]) -> Hash[String, untyped]
|
|
54
|
+
def asked_about(read)
|
|
55
|
+
return {} if read.empty?
|
|
56
|
+
|
|
57
|
+
question = Prompts.text("assess-every-member/ask-whether-a-member-seen-only-as-read-is-loaded")
|
|
58
|
+
{ "seen_only_as_read" => { "members" => read, "question" => question } }
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# The request's part, by its name alone, for a read of the request that prints none of it, so the captured
|
|
62
|
+
# requests go unscanned, with why the index gives no bytes for it; it adds no slot to the answer.
|
|
63
|
+
#: () -> RequestPart
|
|
64
|
+
def not_scanned = NotScanned.new(shown: { PART => {} }, slots: {})
|
|
65
|
+
|
|
66
|
+
# The part a read left unscanned, which the index gives no bytes for, since sizing it would wait on the scan.
|
|
67
|
+
class NotScanned < RequestPart
|
|
68
|
+
# Why the index gives no bytes for this part.
|
|
69
|
+
#: () -> String
|
|
70
|
+
def bytes_unknown
|
|
71
|
+
"Reading this part scans the logged requests, so the index does not size it; read it with part_command."
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# The request's part saying why no logged request is read, from the refusal a read of them gives: its message
|
|
76
|
+
# as the fact, and its repair.
|
|
77
|
+
#: (Hash[String, untyped]) -> RequestPart
|
|
78
|
+
def unread(refusal)
|
|
79
|
+
RequestPart.new(shown: { PART => { "fact" => refusal.fetch("message"), "repair" => refusal.fetch("repair") } },
|
|
80
|
+
slots: {})
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -8,16 +8,18 @@ module Principles
|
|
|
8
8
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
9
9
|
module Views
|
|
10
10
|
# What add-member's result needs to know of the map a member joined, beyond the map itself: whether its
|
|
11
|
-
# principle keeps the others held, which changes the step after mapping,
|
|
12
|
-
# correction may be open on it, so that the member may fix one of its findings, and
|
|
13
|
-
# what to do after mapping: with a principle's first member, or in git the first since the
|
|
14
|
-
# members mapped in one sitting do not each repeat it.
|
|
11
|
+
# principle keeps the others held, and which mapped principles it holds, which changes the step after mapping,
|
|
12
|
+
# whether a full audit's correction may be open on it, so that the member may fix one of its findings, and
|
|
13
|
+
# whether to repeat what to do after mapping: with a principle's first member, or in git the first since the
|
|
14
|
+
# map's last commit, so members mapped in one sitting do not each repeat it.
|
|
15
15
|
class MapAddedTo
|
|
16
16
|
COMPLETENESS_QUESTION = "Is every carrier of the same rule mapped, and should any member belong to another " \
|
|
17
17
|
"principle? "
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
# The ids of the other mapped principles this map keeps held: nil for a map that keeps none held, and empty
|
|
20
|
+
# for the keeping principle's map while no other principle is mapped.
|
|
21
|
+
#: Array[String]?
|
|
22
|
+
attr_reader :keeps_held
|
|
21
23
|
|
|
22
24
|
#: bool
|
|
23
25
|
attr_reader :correction_may_be_open
|
|
@@ -25,11 +27,11 @@ module Principles
|
|
|
25
27
|
#: bool
|
|
26
28
|
attr_reader :reminded
|
|
27
29
|
|
|
28
|
-
#: (?
|
|
30
|
+
#: (?keeps_held: Array[String]?, ?correction_may_be_open: bool, ?reminded: bool,
|
|
29
31
|
#| ?asks_about_completeness: bool, ?new_scope: NewLoadingScope) -> void
|
|
30
|
-
def initialize(
|
|
32
|
+
def initialize(keeps_held: nil, correction_may_be_open: false, reminded: true,
|
|
31
33
|
asks_about_completeness: false, new_scope: NewLoadingScope.new)
|
|
32
|
-
@
|
|
34
|
+
@keeps_held = keeps_held
|
|
33
35
|
@correction_may_be_open = correction_may_be_open
|
|
34
36
|
@reminded = reminded
|
|
35
37
|
@asks_about_completeness = asks_about_completeness
|
|
@@ -40,14 +42,14 @@ module Principles
|
|
|
40
42
|
# This immutable reminder context with the model's decision to ask about coverage, not a completeness verdict.
|
|
41
43
|
#: (asks: bool) -> MapAddedTo
|
|
42
44
|
def with_completeness_question(asks:)
|
|
43
|
-
MapAddedTo.new(
|
|
45
|
+
MapAddedTo.new(keeps_held: @keeps_held, correction_may_be_open: @correction_may_be_open,
|
|
44
46
|
reminded: @reminded, asks_about_completeness: asks, new_scope: @new_scope)
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
# This immutable addition context with the model's new-scope facts, preserving its original reminder flags.
|
|
48
50
|
#: (NewLoadingScope) -> MapAddedTo
|
|
49
51
|
def with_loading_scope(scope)
|
|
50
|
-
MapAddedTo.new(
|
|
52
|
+
MapAddedTo.new(keeps_held: @keeps_held, correction_may_be_open: @correction_may_be_open,
|
|
51
53
|
reminded: @reminded, asks_about_completeness: @asks_about_completeness, new_scope: scope)
|
|
52
54
|
end
|
|
53
55
|
|
|
@@ -78,7 +80,7 @@ module Principles
|
|
|
78
80
|
"Commit #{principle.file} as it changes, so the project's history shows each change; in git, start-audit " \
|
|
79
81
|
"refuses a map that is not committed.\n" \
|
|
80
82
|
"To see the map so far: #{invocation.in_project("show-principle", principle.id)}\n" \
|
|
81
|
-
"#{FirstAudit.new(invocation, in_git:).after_mapping(principle.id,
|
|
83
|
+
"#{FirstAudit.new(invocation, in_git:).after_mapping(principle.id, keeps_held: @keeps_held)}"
|
|
82
84
|
end
|
|
83
85
|
end
|
|
84
86
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
module Views
|
|
6
|
+
# One line, where a map write raised its map from one format to another that releases of principles before
|
|
7
|
+
# release cannot read, so the agent knows before committing it that those copies will refuse it.
|
|
8
|
+
# A write leaving the format as it was, or raising it to one every release reads, prints nothing.
|
|
9
|
+
class MapFormatRaised
|
|
10
|
+
#: (String, from: Integer, to: Integer, release: String?) -> void
|
|
11
|
+
def initialize(id, from:, to:, release:)
|
|
12
|
+
@id = id
|
|
13
|
+
@from = from
|
|
14
|
+
@to = to
|
|
15
|
+
@release = release
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#: () -> Hash[String, String]
|
|
20
|
+
def to_h
|
|
21
|
+
return {} unless @release
|
|
22
|
+
|
|
23
|
+
{ "format_raised" => "This raised #{@id}'s map from format #{@from} to #{@to}; principles before " \
|
|
24
|
+
"#{@release} can no longer read it." }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -20,7 +20,7 @@ module Principles
|
|
|
20
20
|
# The placeholders each printed command leaves for the agent to fill.
|
|
21
21
|
ADD_MEMBER_USAGE = "PATH [--section \"Exact heading text\"] [--starting-at \"text that occurs once\" " \
|
|
22
22
|
"[--ending-at \"text occurring once after the opening\"]] [--query '$.description'] " \
|
|
23
|
-
"--role \"The part it plays\""
|
|
23
|
+
"--role \"The part it plays\" --name NAME --reason REASON"
|
|
24
24
|
|
|
25
25
|
CREATED = "Which files or Markdown sections reinforce this principle? Add each one with the part it plays, " \
|
|
26
26
|
"for example: states the principle, lists the checks, records settled terms, reminds on a timer, " \
|
|
@@ -77,17 +77,28 @@ module Principles
|
|
|
77
77
|
# shared says which members share a line with the new one; added lists them only when there are some, as it
|
|
78
78
|
# carries a check only when one is named. joined is what the result says of the map the member joined.
|
|
79
79
|
#: (PrintedPrinciple, added: Hash[String, untyped], ?shared: LinesSharedWithMember, ?joined: MapAddedTo,
|
|
80
|
-
#| ?
|
|
80
|
+
#| ?other_maps: Array[ConsecutiveSectionsElsewhere | WholeFileElsewhere | MemberSetsOverlap])
|
|
81
81
|
#| -> Hash[String, untyped]
|
|
82
82
|
def member_added(principle, added:, shared: LinesSharedWithMember.new, joined: MapAddedTo.new,
|
|
83
|
-
|
|
84
|
-
member = AddedMember.new(added, shared: shared,
|
|
83
|
+
other_maps: [])
|
|
84
|
+
member = AddedMember.new(added, shared: shared, other_maps: other_maps)
|
|
85
85
|
after = joined.after_member(principle, member: member.id, invocation: @invocation, in_git: @in_git)
|
|
86
86
|
question(principle, "#{member.opening}#{after}".rstrip,
|
|
87
87
|
add_member_command(principle.id), shown: { "member_count" => principle.members.length })
|
|
88
88
|
.merge("added" => member.to_h.merge(joined.added_facts))
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
+
# add-member --plugin: the member read from an installed plugin, with where it comes from, and that it is
|
|
92
|
+
# read-only and how a finding on it is handled.
|
|
93
|
+
#: (PrintedPrinciple, added: Hash[String, untyped]) -> Hash[String, untyped]
|
|
94
|
+
def plugin_member_added(principle, added:)
|
|
95
|
+
question(principle, "Added #{added.fetch("id")}, read-only: principles never edits a plugin's files, which " \
|
|
96
|
+
"the plugin's next update replaces, so a finding on it is fixed in the project's own " \
|
|
97
|
+
"files, deferred upstream or accepted. Add the next member the same way.",
|
|
98
|
+
add_member_command(principle.id), shown: { "member_count" => principle.members.length })
|
|
99
|
+
.merge("added" => added)
|
|
100
|
+
end
|
|
101
|
+
|
|
91
102
|
# add-member's report of the map it started, with the description and activation it wrote, which the agent
|
|
92
103
|
# never typed.
|
|
93
104
|
#: (PrintedPrinciple) -> Hash[String, untyped]
|
|
@@ -95,14 +106,15 @@ module Principles
|
|
|
95
106
|
{ "map_created" => { "description" => principle.description, "activation" => principle.activation } }
|
|
96
107
|
end
|
|
97
108
|
|
|
98
|
-
# move-member: the member's old id, and its new id
|
|
109
|
+
# move-member: the member's old id, and its new id, place and the lines it now spans, not its role or the map,
|
|
110
|
+
# which cost 7.6 KB on a 17-member principle for one member moved.
|
|
99
111
|
#: (PrintedPrinciple, from: String, moved: Hash[String, untyped]) -> Hash[String, untyped]
|
|
100
112
|
def member_moved(principle, from:, moved:)
|
|
101
113
|
id = moved.fetch("id")
|
|
102
114
|
question(principle, "#{id} now spans lines #{moved.fetch("first_line")} to #{moved.fetch("last_line")}" \
|
|
103
115
|
"#{" (moved from #{from})" unless from == id}; if that is not the passage you meant, " \
|
|
104
|
-
"move it again. Check the other members, then start the audit.", start_audit(principle.id)
|
|
105
|
-
|
|
116
|
+
"move it again. Check the other members, then start the audit.", start_audit(principle.id),
|
|
117
|
+
shown: { "member" => moved })
|
|
106
118
|
end
|
|
107
119
|
|
|
108
120
|
# change-member-check: the stored command is the member's check in the map printed beside this, so the
|
|
@@ -113,31 +125,42 @@ module Principles
|
|
|
113
125
|
done = "#{member} is now enforced by the check named in its map entry. The next audit marks it new or " \
|
|
114
126
|
"changed and asks for a review before it runs; nothing runs it automatically: " \
|
|
115
127
|
"you run it when an audit asks for its result."
|
|
116
|
-
return member_replaced(principle,
|
|
128
|
+
return member_replaced(principle, done: done) if hidden.empty?
|
|
117
129
|
|
|
118
|
-
member_replaced(principle,
|
|
119
|
-
done: "#{done} The check holds characters that print escaped or not at all, " \
|
|
130
|
+
member_replaced(principle, done: "#{done} The check holds characters that print escaped or not at all, " \
|
|
120
131
|
"which check_hidden_characters names; make sure each is meant.")
|
|
121
132
|
.merge("check_hidden_characters" => hidden)
|
|
122
133
|
end
|
|
123
134
|
|
|
124
135
|
# change-member-role, change-member-check and remove-member-check: done says what changed. This tool cannot
|
|
125
136
|
# tell in git whether a full audit's correction is open, so the next step names both cases, and
|
|
126
|
-
# the other case by what the agent holds: a correction request (one user on 8e5b3f9)
|
|
127
|
-
|
|
128
|
-
|
|
137
|
+
# the other case by what the agent holds: a correction request (one user on 8e5b3f9), which already
|
|
138
|
+
# prints its submit-answer command with its request id, so this does not repeat it.
|
|
139
|
+
# shown is what it prints of the map, as question takes it.
|
|
140
|
+
#: (PrintedPrinciple, done: String, ?shown: Hash[String, untyped]) -> Hash[String, untyped]
|
|
141
|
+
def member_replaced(principle, done:, shown: { "map" => principle.map })
|
|
129
142
|
question(principle, "#{done} Check the other members, then start the audit.\nIf you hold a correction " \
|
|
130
|
-
"request
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
143
|
+
"request instead, list this member in the changed_map_entries of the fixed disposition " \
|
|
144
|
+
"this change fixes, and submit that request's answer.",
|
|
145
|
+
start_audit(principle.id), shown: shown)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# change-member-role, -name or -reason: the member's id, which commands still take, and the field it
|
|
149
|
+
# changed, the one part that changed, never the whole map, which cost 7.9 KB on a 17-member principle.
|
|
150
|
+
#: (PrintedPrinciple, member: String, field: String, value: String) -> Hash[String, untyped]
|
|
151
|
+
def entry_changed(principle, member:, field:, value:)
|
|
152
|
+
member_replaced(principle, done: "Changed its #{field}.",
|
|
153
|
+
shown: { "member" => { "id" => member, field => value } })
|
|
134
154
|
end
|
|
135
155
|
|
|
156
|
+
# remove-member: the id removed and how many members are left, never the whole map left, which cost 7.9 KB on
|
|
157
|
+
# a 17-member principle; show-principle lists them.
|
|
136
158
|
#: (PrintedPrinciple, removed: String) -> Hash[String, untyped]
|
|
137
159
|
def member_removed(principle, removed:)
|
|
160
|
+
left = principle.map.fetch("members").size
|
|
138
161
|
question(principle, "Removed #{removed}. Add or remove members until the map is right.\n" \
|
|
139
162
|
"#{FirstAudit.new(@invocation, in_git: @in_git).after_mapping(principle.id)}",
|
|
140
|
-
add_member_command(principle.id))
|
|
163
|
+
add_member_command(principle.id), shown: { "member_removed" => removed, "members_left" => left })
|
|
141
164
|
end
|
|
142
165
|
|
|
143
166
|
private
|
|
@@ -34,7 +34,7 @@ module Principles
|
|
|
34
34
|
#: (String) -> String
|
|
35
35
|
def empty_map(id)
|
|
36
36
|
"#{id} has no members. Add its first member: " \
|
|
37
|
-
"#{@invocation.in_project("add-member", id, usage: "PATH --role ROLE")}"
|
|
37
|
+
"#{@invocation.in_project("add-member", id, usage: "PATH --role ROLE --name NAME --reason REASON")}"
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
#: (String) -> String
|
|
@@ -7,8 +7,9 @@ module Principles
|
|
|
7
7
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
8
|
module Views
|
|
9
9
|
# One changed member as a line of tab-separated fields, each written through VisibleText: its principle, id,
|
|
10
|
-
# newest commit that changed it (or "uncommitted"), that commit's subject, and
|
|
11
|
-
# "audit" or "
|
|
10
|
+
# newest commit that changed it (or "uncommitted", or a plugin's "version:" installed), that commit's subject, and
|
|
11
|
+
# what it was compared with: "audit", "mapping_commit" or "pinned", then "waiting_on_an_upgrade" for one compared
|
|
12
|
+
# with hashes a later copy wrote.
|
|
12
13
|
# The after-commit hook prints it, and list-member-problems --short its short form, without the subject.
|
|
13
14
|
class MemberRow
|
|
14
15
|
# member is one entry of list-member-problems' "members", with its "history".
|
|
@@ -32,11 +33,19 @@ module Principles
|
|
|
32
33
|
|
|
33
34
|
private
|
|
34
35
|
|
|
35
|
-
# The principle, id and newest commit that changed the member, or "uncommitted"
|
|
36
|
+
# The principle, id and newest commit that changed the member, or "uncommitted", or for a plugin's member, which
|
|
37
|
+
# no commit changes, the version installed now.
|
|
36
38
|
#: () -> Array[String]
|
|
37
39
|
def head
|
|
38
40
|
newest = @member.fetch("history", {}).fetch("commits", []).first
|
|
39
|
-
[@member.fetch("principle"), @member.fetch("id"), newest ? newest.fetch("commit") :
|
|
41
|
+
[@member.fetch("principle"), @member.fetch("id"), newest ? newest.fetch("commit") : changed_in]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Where a member no commit changed is changed now: a plugin's version installed, or else uncommitted text.
|
|
45
|
+
#: () -> String
|
|
46
|
+
def changed_in
|
|
47
|
+
version = @member.dig("source", "version")
|
|
48
|
+
version ? "version:#{version}" : "uncommitted"
|
|
40
49
|
end
|
|
41
50
|
|
|
42
51
|
# What the member was compared with, and whether its audit waits on an upgrade.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
module Views
|
|
6
|
+
# The other maps whose member set nearly matches the one a member just joined, which ask the agent AddedMember's
|
|
7
|
+
# scope-or-join question.
|
|
8
|
+
class MemberSetsOverlap
|
|
9
|
+
#: (?Array[Hash[String, untyped]]) -> void
|
|
10
|
+
def initialize(facts = [])
|
|
11
|
+
@facts = facts
|
|
12
|
+
freeze
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
#: () -> Hash[String, untyped]
|
|
16
|
+
def to_h = @facts.empty? ? {} : { "member_sets_overlap" => @facts }
|
|
17
|
+
|
|
18
|
+
#: () -> String
|
|
19
|
+
def note
|
|
20
|
+
return "" if @facts.empty?
|
|
21
|
+
|
|
22
|
+
"This map's member set nearly matches another's (member_sets_overlap): by member id, they share at least " \
|
|
23
|
+
"two members and at least two thirds of the members either holds. "
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Whether it asks AddedMember's scope-or-join question: when a member set nearly matches.
|
|
27
|
+
#: () -> bool
|
|
28
|
+
def asks_scope_or_join? = @facts.any?
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -14,18 +14,38 @@ module Principles
|
|
|
14
14
|
module Views
|
|
15
15
|
# list-member-problems --commits-after COMMIT --hook-event EVENT: the whole JSON the plugin's after-commit hook
|
|
16
16
|
# prints for Claude Code, which puts its additionalContext beside the Bash call's result, or nothing at all.
|
|
17
|
-
# Claude Code asks
|
|
18
|
-
#
|
|
19
|
-
#
|
|
17
|
+
# Claude Code's hooks page asks that additionalContext be "factual statements rather than imperative system
|
|
18
|
+
# instructions", since imperative text can be surfaced to the user as a suspected injection (the
|
|
19
|
+
# after-commit hook review, R7). So it states what the commits changed, then the one command that shows what
|
|
20
|
+
# each needs before the next commit: a second pointer, the plugin's skill, left the agent choosing.
|
|
20
21
|
class MembersACommitChanged
|
|
21
22
|
NOTHING = Lines.new(stdout: "", stderr: "", status: 0).freeze #: Lines
|
|
22
23
|
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
# How many other changed members list-member-problems still lists: those earlier commits changed, and those in
|
|
25
|
+
# an installed plugin, which no commit changes.
|
|
26
|
+
StillListed = Struct.new(:from_commits, :in_plugins) do
|
|
27
|
+
#: () -> bool
|
|
28
|
+
def none? = from_commits.zero? && in_plugins.zero?
|
|
29
|
+
|
|
30
|
+
# A line for each kind still listed, or none.
|
|
31
|
+
#: () -> Array[String]
|
|
32
|
+
def lines
|
|
33
|
+
commits = Prompts.text("report-after-a-commit/others-are-still-listed",
|
|
34
|
+
count: from_commits.to_s, members: members(from_commits))
|
|
35
|
+
plugins = Prompts.text("report-after-a-commit/plugin-members-are-still-listed",
|
|
36
|
+
count: in_plugins.to_s, members: members(in_plugins))
|
|
37
|
+
[*(commits unless from_commits.zero?), *(plugins unless in_plugins.zero?)]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
#: (Integer) -> String
|
|
43
|
+
def members(count) = count == 1 ? "member is" : "members are"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
#: (Invocation) -> void
|
|
47
|
+
def initialize(invocation)
|
|
27
48
|
@invocation = invocation
|
|
28
|
-
@skill = skill
|
|
29
49
|
freeze
|
|
30
50
|
end
|
|
31
51
|
|
|
@@ -33,7 +53,7 @@ module Principles
|
|
|
33
53
|
# members it still lists. Those it marks waiting_on_an_upgrade are named apart, with the waits that say why, and
|
|
34
54
|
# no audit to run; the others still listed are counted beside them too, since this copy may
|
|
35
55
|
# audit those.
|
|
36
|
-
#: (String, Array[Hash[String, untyped]], others:
|
|
56
|
+
#: (String, Array[Hash[String, untyped]], others: StillListed, ?waits: Array[RecordWaitingOnAnUpgrade]) -> Lines
|
|
37
57
|
def changed(event, changed, others:, waits: [])
|
|
38
58
|
waiting, auditable = changed.partition { |member| member["waiting_on_an_upgrade"] }
|
|
39
59
|
reported(event, [*(to_audit(auditable, others) unless auditable.empty?),
|
|
@@ -50,20 +70,26 @@ module Principles
|
|
|
50
70
|
|
|
51
71
|
private
|
|
52
72
|
|
|
53
|
-
# The members to audit, as rows, then
|
|
54
|
-
#: (Array[Hash[String, untyped]],
|
|
73
|
+
# The members to audit, as rows, then the command that shows what each needs before the next commit.
|
|
74
|
+
#: (Array[Hash[String, untyped]], StillListed) -> Array[String]
|
|
55
75
|
def to_audit(changed, others)
|
|
56
76
|
[Prompts.text("report-after-a-commit/the-commits-changed-these-members"), *rows(changed),
|
|
57
|
-
*
|
|
58
|
-
*(Prompts.text("report-after-a-commit/the-principles-skill-is-where-to-start") if @skill)]
|
|
77
|
+
*others.lines, before_the_next_commit]
|
|
59
78
|
end
|
|
60
79
|
|
|
61
80
|
# The other changed members still listed, and the command that shows each, or nothing when none is.
|
|
62
|
-
#: (
|
|
81
|
+
#: (StillListed) -> Array[String]
|
|
63
82
|
def listed_beside_the_waiting(others)
|
|
64
|
-
return [] if others.
|
|
83
|
+
return [] if others.none?
|
|
65
84
|
|
|
66
|
-
[*
|
|
85
|
+
[*others.lines, before_the_next_commit]
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# The one command that shows what each member needs before the next commit, list-member-problems --short.
|
|
89
|
+
#: () -> String
|
|
90
|
+
def before_the_next_commit
|
|
91
|
+
Prompts.text("report-after-a-commit/this-command-shows-what-each-needs-before-the-next-commit",
|
|
92
|
+
command: @invocation.in_project("list-member-problems", options: ["--short"]))
|
|
67
93
|
end
|
|
68
94
|
|
|
69
95
|
# The members whose audits wait on an upgrade, as rows, then each wait's line, which says how to update.
|
|
@@ -76,15 +102,6 @@ module Principles
|
|
|
76
102
|
#: (Array[Hash[String, untyped]]) -> Array[String]
|
|
77
103
|
def rows(members) = members.map { MemberRow.new(it).to_s }
|
|
78
104
|
|
|
79
|
-
# The line saying how many other changed members list-member-problems still lists, or none when it lists none.
|
|
80
|
-
#: (Integer) -> Array[String]
|
|
81
|
-
def still_listed(others)
|
|
82
|
-
return [] if others.zero?
|
|
83
|
-
|
|
84
|
-
[Prompts.text("report-after-a-commit/others-are-still-listed",
|
|
85
|
-
count: others.to_s, members: others == 1 ? "member is" : "members are")]
|
|
86
|
-
end
|
|
87
|
-
|
|
88
105
|
#: () -> String
|
|
89
106
|
def command = @invocation.in_project("list-member-problems")
|
|
90
107
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
|
+
module Views
|
|
7
|
+
# The audited principle's members that changed during a completed audit, as its result names them: each member
|
|
8
|
+
# added to the map during the audit, which no assessment read, so the next full audit assesses it (T69), and
|
|
9
|
+
# each member whose text changed, after which the next step asks for the principle's audit again.
|
|
10
|
+
class MembersChangedDuringAudit
|
|
11
|
+
#: (?added: Array[String], ?changed: Array[String]) -> void
|
|
12
|
+
def initialize(added: [], changed: [])
|
|
13
|
+
@added = added
|
|
14
|
+
@changed = changed
|
|
15
|
+
freeze
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Whether any member's text changed during the audit; when none did, nothing asks for a second audit.
|
|
19
|
+
#: () -> bool
|
|
20
|
+
def any? = @changed.any?
|
|
21
|
+
|
|
22
|
+
# The fields as printed: the members added, only when there are some.
|
|
23
|
+
#: () -> Hash[String, untyped]
|
|
24
|
+
def to_h = @added.empty? ? {} : { "members_added_awaiting_assessment" => @added }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "logged_request_status_meanings"
|
|
5
|
+
require_relative "problem_lines"
|
|
6
|
+
require_relative "prompts"
|
|
7
|
+
require_relative "../prose_list"
|
|
8
|
+
|
|
9
|
+
module Principles
|
|
10
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
|
+
module Views
|
|
12
|
+
# How many mapped members have each status, so the agent sizes what it reads before reading any member, what each
|
|
13
|
+
# status means, then which mapped members' text the captured requests held, by member, how many requests have no
|
|
14
|
+
# query_source, which requests quote a logged request's path, which the scan could not read through, how complete
|
|
15
|
+
# the scan was, and the files the scan wrote: none.
|
|
16
|
+
class MembersInLoggedRequestsResult
|
|
17
|
+
# The scan's report this prints, as plain values.
|
|
18
|
+
#: type seen = { members_by_status: Hash[String, Integer], members: Array[Hash[String, untyped]],
|
|
19
|
+
#| orphans: Integer, quoting_requests: Array[String], requests_by_kind: Hash[String, Integer],
|
|
20
|
+
#| model_turns_by_position: Hash[String, Integer],
|
|
21
|
+
#| model_turns_by_query_source: Hash[String, Hash[String, Integer]],
|
|
22
|
+
#| unreadable: Array[Hash[String, String]], completeness: Hash[String, untyped] }
|
|
23
|
+
|
|
24
|
+
# How each model turn's position was told, since the host does not say.
|
|
25
|
+
POSITION_HEURISTIC = "Not said by the host: a model turn that continues a thread is mid_turn; any other is " \
|
|
26
|
+
"told by how its last message ends: turn_opening is user or system text with no tool " \
|
|
27
|
+
"result, mid_turn ends with a tool result, and unclassified is neither, so outside a " \
|
|
28
|
+
"thread, text the host adds mid-turn reads as turn_opening." #: String
|
|
29
|
+
|
|
30
|
+
# What a request continuing a thread holds, so the agent reads a member's presence there as text added then.
|
|
31
|
+
#: () -> String
|
|
32
|
+
def self.what_a_continuation_holds
|
|
33
|
+
Prompts.text("read-what-reached-the-context/what-a-thread-continuation-holds")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# The result from seen, the scan's report, as the request logging gives it, saying how a request's kind was
|
|
37
|
+
# told from side_call_sources, the query_sources whose requests that continue no thread are side calls.
|
|
38
|
+
#: (seen, side_call_sources: Array[String]) -> Hash[String, untyped]
|
|
39
|
+
def result(seen, side_call_sources:)
|
|
40
|
+
{ "members_by_status" => seen[:members_by_status], "status_meanings" => LoggedRequestStatusMeanings.new.to_h,
|
|
41
|
+
"members" => seen[:members], "orphans" => seen[:orphans],
|
|
42
|
+
"requests_by_kind" => seen[:requests_by_kind],
|
|
43
|
+
"kind_heuristic" => kind_heuristic(side_call_sources),
|
|
44
|
+
"model_turns_by_position" => seen[:model_turns_by_position],
|
|
45
|
+
"model_turns_by_query_source" => seen[:model_turns_by_query_source],
|
|
46
|
+
"position_heuristic" => POSITION_HEURISTIC,
|
|
47
|
+
"what_a_continuation_holds" => self.class.what_a_continuation_holds,
|
|
48
|
+
"quoting_requests" => seen[:quoting_requests], "unreadable" => seen[:unreadable],
|
|
49
|
+
"completeness" => seen[:completeness], "wrote" => [] }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# --short: the count of members with each status, with how many requests the scan read, whether it read every
|
|
53
|
+
# one through, since an absence holds only then, how many it could not read, and how many quote a logged
|
|
54
|
+
# request, where a presence may be a quote; then what a continuation holds; then what each member line says; then
|
|
55
|
+
# one tab-separated line a member: its status, principle, member key, with its id where it is now once moved, the
|
|
56
|
+
# segments it was seen in, and its requests by channel, each or - for none.
|
|
57
|
+
#: (seen) -> Lines
|
|
58
|
+
def short(seen)
|
|
59
|
+
legend = Prompts.text("read-what-reached-the-context/what-each-member-line-says")
|
|
60
|
+
lines = [counts(seen), self.class.what_a_continuation_holds, legend, *seen[:members].map { member_line(it) }]
|
|
61
|
+
Lines.new(stdout: lines.map { "#{it}\n" }.join, stderr: "", status: 0)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
|
|
66
|
+
# How each request's kind was told, since the host does not say either, with side_call_sources, the
|
|
67
|
+
# query_sources whose requests that continue no thread are side calls, by name.
|
|
68
|
+
#: (Array[String]) -> String
|
|
69
|
+
def kind_heuristic(side_call_sources)
|
|
70
|
+
"Not said by the host: a request that continues a thread, naming the message before it, is a model_turn. " \
|
|
71
|
+
"A request under #{ProseList.new(side_call_sources)} that does not continue a thread is a side_call, a " \
|
|
72
|
+
"label-based exception from one log, observed 2026-11-28, so such a request from a side-call source not " \
|
|
73
|
+
"listed counts as a model turn. Any other request is told by its shape: model_turn lists " \
|
|
74
|
+
"tools, side_call lists none and holds one or two messages, and unclassified is neither."
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# The counts by status, then what the scan read, then the requests by kind and the model turns by position, as
|
|
78
|
+
# short prints it.
|
|
79
|
+
#: (seen) -> String
|
|
80
|
+
def counts(seen)
|
|
81
|
+
completeness = seen[:completeness]
|
|
82
|
+
whole = completeness.fetch("complete") ? "complete" : "not complete"
|
|
83
|
+
read = "#{completeness.fetch("captured")} captured, #{whole}, #{seen[:unreadable].size} unreadable, " \
|
|
84
|
+
"#{seen[:quoting_requests].size} quoting a logged request"
|
|
85
|
+
"#{counted(seen[:members_by_status])}; #{read}; requests by kind: #{counted(seen[:requests_by_kind])}; " \
|
|
86
|
+
"model turns by position: #{counted(seen[:model_turns_by_position])}; " \
|
|
87
|
+
"model turns by query_source (turn_opening/mid_turn/unclassified): #{by_source(seen)}"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Each query_source's model turns at each position, as source opening/mid/unclassified, joined by commas, or -
|
|
91
|
+
# for none; each source's counts come in that order, as the report gives every position.
|
|
92
|
+
#: (seen) -> String
|
|
93
|
+
def by_source(seen)
|
|
94
|
+
sources = seen[:model_turns_by_query_source].map { |source, counts| "#{source} #{counts.values.join("/")}" }
|
|
95
|
+
listed(sources)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Each of counts as its name and count, joined by commas.
|
|
99
|
+
#: (Hash[String, Integer]) -> String
|
|
100
|
+
def counted(counts) = counts.map { |name, count| "#{name} #{count}" }.join(", ")
|
|
101
|
+
|
|
102
|
+
# One member's line: status, principle, member key, with its id where it is now once moved, the distinct
|
|
103
|
+
# segments it was seen in, and how many requests held it by each channel, as channel:count.
|
|
104
|
+
#: (Hash[String, untyped]) -> String
|
|
105
|
+
def member_line(member)
|
|
106
|
+
channels = member.fetch("channels").map { |channel, count| "#{channel}:#{count}" }
|
|
107
|
+
[*member.values_at("status", "principle"), named(member), listed(member.fetch("segments")), listed(channels)]
|
|
108
|
+
.join("\t")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# items joined by commas, or - for none.
|
|
112
|
+
#: (Array[String]) -> String
|
|
113
|
+
def listed(items) = items.empty? ? "-" : items.join(",")
|
|
114
|
+
|
|
115
|
+
# member's key, followed by its id once a move has left the key naming where it was.
|
|
116
|
+
#: (Hash[String, untyped]) -> String
|
|
117
|
+
def named(member)
|
|
118
|
+
key = member.fetch("member")
|
|
119
|
+
member.key?("id") ? "#{key} (now #{member.fetch("id")})" : key
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|