@mangeshraut712/merge-guide 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CONTRIBUTING.md +33 -0
  2. package/LICENSE +21 -0
  3. package/README.md +150 -2
  4. package/bin/merge-guide.js +118 -0
  5. package/docs/README.md +12 -0
  6. package/docs/adoption.json +17 -0
  7. package/docs/analytics.md +12 -0
  8. package/docs/case-studies.md +37 -0
  9. package/docs/compatibility.md +13 -0
  10. package/docs/examples.md +36 -0
  11. package/docs/installer.md +68 -0
  12. package/docs/maintenance.md +13 -0
  13. package/docs/results.md +50 -0
  14. package/docs/troubleshooting.md +20 -0
  15. package/package.json +42 -4
  16. package/skills/oss-contribution-insights/LICENSE +21 -0
  17. package/skills/oss-contribution-insights/SKILL.md +65 -0
  18. package/skills/oss-contribution-insights/agents/openai.yaml +7 -0
  19. package/skills/oss-contribution-insights/assets/example-ledger.json +36 -0
  20. package/skills/oss-contribution-insights/references/c-cpp-contributions.md +27 -0
  21. package/skills/oss-contribution-insights/references/contributor-playbook.md +47 -0
  22. package/skills/oss-contribution-insights/references/evidence-and-ledger.md +96 -0
  23. package/skills/oss-contribution-insights/references/maintenance.md +35 -0
  24. package/skills/oss-contribution-insights/references/validation.md +10 -0
  25. package/skills/oss-contribution-insights/scripts/collect_pr_evidence.py +145 -0
  26. package/skills/oss-contribution-insights/scripts/ledger.py +138 -0
  27. package/skills/oss-contribution-insights/scripts/test_collect_pr_evidence.py +141 -0
  28. package/skills/oss-contribution-insights/scripts/test_ledger.py +117 -0
  29. package/skills/oss-contribution-insights/scripts/test_packaging.py +33 -0
@@ -0,0 +1,20 @@
1
+ # Installation and troubleshooting
2
+
3
+ Start with the [README installation steps](../README.md). The installed skill is named `oss-contribution-insights`; the npm installer executable is named `merge-guide`.
4
+
5
+ | Symptom | Check | Safe next step |
6
+ | --- | --- | --- |
7
+ | Copy says target exists | Existing directory, file or symlink at the destination | Inspect and back up your existing install; do not overwrite or delete it blindly |
8
+ | Source SKILL.md missing | Shell working directory | Run the copy block from the repository root containing `skills/` |
9
+ | Skill absent in runtime | Supported user-skill location and exact frontmatter name | Use your runtime's documented discovery/refresh procedure; confirm file access |
10
+ | Display title absent | Runtime version and optional metadata support | The legacy invocation is `oss-contribution-insights`; see tested version in results |
11
+ | Runtime or sandbox fails before task | Actual error and environment | Use supported setup/support flow; do not copy credentials or bypass controls |
12
+ | Helper cannot run | Python 3.10+; for live collection an already authenticated `gh` | Offline ledger/tests need no GitHub login; live access is separate |
13
+ | Partial collector result | Recorded errors, sampled head and coverage | Keep the incomplete interval pending; do not treat it as no feedback |
14
+ | Output already exists | Non-destructive helper behavior | Choose a new authorized private output path |
15
+
16
+ Installation means files were copied. Discovery means the runtime found an enabled skill. Invocation means a task actually ran using it. None proves a contribution was accepted.
17
+
18
+ For an upgrade, inspect the new source and diff first. Keep user-local modifications and private ledgers separate; the README block intentionally refuses existing targets rather than implementing an updater. To remove an installation, identify the exact installed folder and back up local changes, then use your runtime's supported removal procedure. This repository has no background daemon to uninstall.
19
+
20
+ Installer checks and agent discovery are different: see the dated platform results rather than assuming that copying files proves an agent can execute the skill. See [results and limitations](results.md).
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@mangeshraut712/merge-guide",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Install Mangesh\u2019s Merge Guide into a supported agent skill directory",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "merge-guide": "bin/merge-guide.js"
9
+ },
10
+ "engines": {
11
+ "node": ">=20"
12
+ },
13
+ "files": [
14
+ "bin/*.js",
15
+ "skills/oss-contribution-insights/SKILL.md",
16
+ "skills/oss-contribution-insights/LICENSE",
17
+ "skills/oss-contribution-insights/agents/*.yaml",
18
+ "skills/oss-contribution-insights/assets/*.json",
19
+ "skills/oss-contribution-insights/references/*.md",
20
+ "skills/oss-contribution-insights/scripts/*.py",
21
+ "README.md",
22
+ "LICENSE",
23
+ "docs/*.md",
24
+ "CONTRIBUTING.md",
25
+ "docs/adoption.json"
26
+ ],
27
+ "scripts": {
28
+ "test": "node --test test/installer.test.js",
29
+ "test:package": "node test/package-smoke.js",
30
+ "metrics": "python3 scripts/update-adoption.py"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/mangeshraut712/mangeshs-merge-guide.git"
35
+ },
36
+ "homepage": "https://github.com/mangeshraut712/mangeshs-merge-guide#readme",
37
+ "bugs": {
38
+ "url": "https://github.com/mangeshraut712/mangeshs-merge-guide/issues"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public",
42
+ "registry": "https://registry.npmjs.org/"
43
+ }
44
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mangesh Raut
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: oss-contribution-insights
3
+ description: Tackle useful open-source issues from selection and reproduction through implementation, regression tests, PR preparation, review comments, and maintainer follow-through. Use for first contributions, complex fixes, current PR feedback, and merge-readiness. Learn from verified accepted work and setbacks without promising acceptance; contribution analytics are optional supporting evidence.
4
+ ---
5
+
6
+ # Mangesh’s Merge Guide
7
+
8
+ Help the contributor complete a useful change that a maintainer can confidently evaluate. Default to the current issue or PR, not a history report. Optimize for maintainer value and reviewability, not PR volume or a promised merge rate.
9
+
10
+ For C or C++ repositories, use [the C/C++ contribution track](references/c-cpp-contributions.md) for build identity, memory/concurrency safety, portability, ABI and sanitizer verification. Follow the target project’s language rather than rewriting unrelated tooling.
11
+
12
+ ## Run a contribution work session
13
+
14
+ 1. Establish the requested outcome and exact authorization. Resume existing owned work before starting another fix. Read current local/remote state and any outstanding review.
15
+ 2. Select a wanted, reproducible issue using the criteria below. If no target is given, produce a short ranked shortlist with maintainer need, duplicate risk, verification feasibility and the smallest next step; do not auto-claim issues.
16
+ 3. Reproduce on the supported base, identify the contract and real execution path, then implement the smallest sufficient fix within authorized local scope. Follow the validation steps below.
17
+ 4. Review the actual final diff and evidence. Prepare a truthful PR and reviewer handoff. Publish only when separately authorized; a polished draft is a useful result when publication is not authorized.
18
+ 5. Address review substance with changes and evidence, preserving scope and human-involvement requirements. Revalidate the latest head and distinguish author work from maintainer-only gates.
19
+ 6. Verify the eventual outcome and retain a scoped lesson for the next contribution when supported by evidence. Consult historical evidence only when it can change the current decision; do not start an account-wide audit by default.
20
+
21
+ End each session with: target and head → completed change → exact test results → open feedback or blocker → next action and owner. Do not substitute a score or merge count for this deliverable.
22
+
23
+ Read [the contributor playbook](references/contributor-playbook.md) for beginner onboarding, issue triage, review comments, communication and advanced maintenance. Adapt explanation to experience; keep the same evidence and permission standards.
24
+
25
+ ## Establish the task and evidence
26
+
27
+ - Determine the repository or PR set, timeframe, requested deliverable, and authorized actions. Research, a draft, or use of this skill does not authorize posting, pushing, merging, or scheduled outreach.
28
+ - Read current `AGENTS.md`, contribution instructions, PR template, tests, AI policy, and any issue-specific maintainer direction. Respect required human understanding, review, and authorship; pause for genuine human participation where required. Never tick human or legal attestations on the user’s behalf merely to satisfy a template, rebrand prohibited generated work as human work, or bypass contribution restrictions.
29
+ - Read [the evidence method and ledger format](references/evidence-and-ledger.md) for a retrospective, broad inventory, or tracked review. Read [maintenance and incremental refresh](references/maintenance.md) when activity changes or a recurring refresh is requested.
30
+ - Use a private, authorized evidence ledger for real history. The bundled `assets/example-ledger.json` is synthetic and demonstrates the schema only, not real contributions. Query a ledger with `python3 scripts/ledger.py summary PATH` or `show PATH --repository OWNER/REPO --number N`.
31
+ - Prefer the connected GitHub tools. When `gh` is available and authenticated, optionally use `python3 scripts/collect_pr_evidence.py OWNER/REPO NUMBER --output PATH` for a read-only snapshot. It records per-section failures and the sampled head. Read actual linked diffs, policies, logs, and discussion; metadata alone is insufficient.
32
+
33
+ ## Choose a contribution that belongs
34
+
35
+ Before substantial coding, establish a real problem on the current supported branch and a useful upstream owner or area. Check existing issues, required assignment/claim, competing PRs, recent fixes, release scope, and policy. Recheck freshness before submission. Prioritize unresolved review requests and a few complete contributions over new volume; honor current per-project open-PR limits and explicit cadence constraints. Do not convert one project’s limit into a universal quota.
36
+
37
+ Prefer bounded changes with an observable user or maintainer benefit and a credible test. A large diff can be justified; “small” alone is not evidence of value. If the current branch is unaffected, the change is already covered, the project forbids the proposed assistance, or the maintainer declines scope, stop that line of contribution and report the reason. Ask a concise scope question only when needed and when sending is authorized.
38
+
39
+ ## Prepare evidence before requesting review
40
+
41
+ Read [reproduction and final validation](references/validation.md) when implementing or reviewing a patch. Record the base and final revision, reproduce the actual consumer behavior, establish failing-before/passing-after evidence when applicable, and run the repository’s required checks. Distinguish passing, failing, blocked and unrun checks; preserve user changes. Inspect feedback and CI on the current head before claiming readiness.
42
+
43
+ ## Make the maintainer's decision easier
44
+
45
+ Prepare the repository's requested PR format. Include the problem and reproducer, why the chosen change fixes it, concise before/after evidence, exact verification, compatibility or risk, and any known limits. Link the relevant issue accurately. Disclose AI assistance when required and preserve truthful authorship and provenance. Do not fabricate benchmark numbers, tests, manual inspection, or maintainer statements.
46
+
47
+ When publication is authorized, default to a draft PR unless the user specifies otherwise. Follow repository-specific requirements that are compatible with platform policy. Do not publish just to increase counts.
48
+
49
+ Keep approved scope stable; explain necessary changes and seek renewed review rather than silently expanding it. For feedback, maintain a compact map: maintainer request → change or reasoned response → test or evidence. Address the substance before replying. Update stale branches only when needed and authorized, and recheck affected behavior afterward. Avoid empty progress comments, repeated review nudges, and automated “merged main” messages. Silence is not rejection; choose follow-up timing from explicit project expectations and the user's authorization, not a universal timer.
50
+
51
+ Merge, auto-merge, deployment, and external communication each retain their own authorization gates. A maintainer owns the upstream decision. Never bypass protections or imply the skill can secure acceptance.
52
+
53
+ ## Learn and apply
54
+
55
+ For each outcome, record the strongest demonstrated positive, the main friction or improvement, what changed, and the remaining uncertainty. Separate:
56
+
57
+ - **Observation:** a test, comment, commit, check, or lifecycle event directly shows it.
58
+ - **Interpretation:** a bounded explanation supported by those facts.
59
+ - **Experiment:** a concrete process change to try next, with a way to judge it.
60
+
61
+ Count distinct repositories and distinct PR identities behind patterns. Separate native merge, full credited landing, partial credit, ports/backports, supersession, withdrawal, documented rejection, inferred disposition, unresolved closure, and open work. Deduplicate related ports before reporting unique changes. Record the final accepted scope and contributor/maintainer roles, not just the original title. Include non-wins and uncertainty. Do not infer causality from merge timing or pool unlike projects into a spurious acceptance score.
62
+
63
+ Recheck later feedback on merged or landed work when a follow-up is requested or relevant new activity appears. Preserve the original merge/landing and separately record a discovered defect, correction, revert, or unresolved report; merged does not mean correct or permanently complete.
64
+
65
+ Finish with a concise evidence-linked assessment: what worked, what improved, what remains blocked, and the next specific action. Update the task's approved contribution ledger in place when maintaining one; keep private retrospectives out of upstream repositories unless the user explicitly requests publication. Update the ledger when permitted evidence changes. Amend reusable guidance only for a meaningful demonstrated lesson, not every new merge; validate and verify the saved skill after an edit. Skill content does not create a running automation, broaden access, or grant GitHub write permission. Claim ongoing monitoring only after a supported schedule or event subscription is verified.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: Mangesh’s Merge Guide
3
+ short_description: Tackle issues and prepare reviewable OSS fixes
4
+ default_prompt: Use $oss-contribution-insights to tackle the current issue, reproduce it,
5
+ implement and validate a useful fix, and prepare a truthful maintainer handoff.
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,36 @@
1
+ {
2
+ "metadata": {
3
+ "author": "example",
4
+ "scope": "synthetic demonstration only",
5
+ "as_of": "2026-11-12"
6
+ },
7
+ "records": [
8
+ {
9
+ "pull_request_node_id": "SYNTHETIC_PR_1",
10
+ "repository": "example/project",
11
+ "number": 1,
12
+ "url": "https://github.com/example/project/pull/1",
13
+ "github_lifecycle": "github_merged",
14
+ "disposition": "github_merged",
15
+ "discussion_coverage": "synthetic"
16
+ },
17
+ {
18
+ "pull_request_node_id": "SYNTHETIC_PR_2",
19
+ "repository": "example/project",
20
+ "number": 2,
21
+ "url": "https://github.com/example/project/pull/2",
22
+ "github_lifecycle": "open",
23
+ "disposition": "open",
24
+ "discussion_coverage": "synthetic"
25
+ },
26
+ {
27
+ "pull_request_node_id": "SYNTHETIC_PR_3",
28
+ "repository": "example/project",
29
+ "number": 3,
30
+ "url": "https://github.com/example/project/pull/3",
31
+ "github_lifecycle": "closed_without_github_merge",
32
+ "disposition": "unresolved",
33
+ "discussion_coverage": "synthetic"
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,27 @@
1
+ # C and C++ contribution track
2
+
3
+ Use when the target project is C or C++. A contribution skill is primarily instructions; rewriting a small network/JSON evidence helper in C++ does not inherently improve contributions. Choose implementation language from the target repository and measurable needs, not prestige. Introduce native tooling only with a concrete benefit, an agreed interface and relevant tests.
4
+
5
+ ## Establish the build and failing behavior
6
+
7
+ - Read the supported compiler, language standard, build system and platform matrix. Record actual compiler executable/version, generator and dependency versions. Use the repository's presets or documented CMake, Meson, Bazel, Make or other commands; do not invent a universal build invocation.
8
+ - Keep build outputs outside source files as the project expects. Reproduce with its prescribed debug/test configuration and the actual library/application under test. Beware stale installed libraries, wrong shared-library lookup paths and configuration-dependent tests.
9
+ - Reduce the issue to a bounded reproducer that fails on the recorded base and passes after the fix. Distinguish a compiler warning, crash, memory error, race, numerical discrepancy and API-contract failure. A passing compilation is not a behavioral test.
10
+
11
+ ## Fix the real contract
12
+
13
+ - Check lifetime/ownership, iterator and reference invalidation, integer conversion/overflow, bounds, initialization, error propagation and exception safety where applicable. Preserve resource cleanup on early failure. Avoid repairing a symptom while introducing undefined behavior.
14
+ - Preserve supported language versions and C/C++ linkage. For public libraries check ABI/API compatibility, exported symbols, struct layout/alignment, calling conventions and downstream consumers as relevant. Do not change layouts or signatures silently.
15
+ - Validate platform-specific code on the real supported platform where possible. Consider pointer/size widths, signedness, endianness, alignment, compiler extensions and Windows/POSIX differences. A renamed mock fixture is not cross-platform testing.
16
+ - Keep security contracts, input bounds and concurrency invariants intact. Do not disable validation or synchronization just to make a test pass. Handle vulnerability findings under the project's disclosure policy.
17
+
18
+ ## Validate proportionately
19
+
20
+ - Run the repository's focused regression and required aggregate tests, formatting, static analysis and warning policy. Use its supported sanitizer configurations: ASan for memory errors, UBSan for undefined behavior, and TSan for races where compatible. These are complementary configurations, not universally combinable flags. Report unavailable or unsupported sanitizer runs honestly.
21
+ - For performance changes compare equivalent optimized builds and repeat representative workloads, recording hardware, compiler flags, noise and correctness checks. Do not claim a speedup from one debug run or change workloads to favor the patch.
22
+ - Exercise error and boundary paths. For concurrency fixes use deterministic coordination where practical; stress tests alone cannot prove race freedom. Fuzz only within authorized resources and scope.
23
+ - Record final head, exact commands and results, including skipped platform jobs. A green local Linux build does not certify macOS/Windows, all compilers or an ABI guarantee.
24
+
25
+ ## Maintainer handoff
26
+
27
+ Explain the original failure, why the fix respects ownership/compatibility constraints, the regression evidence, supported configurations tested and residual limitations. Keep a code change small enough to review but complete enough to solve the issue. Do not submit speculative refactors or demand an upstream C/C++ rewrite when a project uses another language.
@@ -0,0 +1,47 @@
1
+ # Contributor playbook: first issue to ongoing maintenance
2
+
3
+ Use this guide to adapt assistance to the contributor's experience. Explain unfamiliar terms, ask what they can reproduce, and offer the next small step rather than a wall of commands. Do not assume paid tools, maintainer access or a particular operating system. Let experienced contributors skip setup explanations while preserving verification and policy gates.
4
+
5
+ ## First contribution
6
+
7
+ 1. Identify the actual user problem, a supported release, and an accessible development environment. A “good first issue” label is a lead, not proof that it is current or unclaimed.
8
+ 2. Read the contribution guide, code of conduct, issue/PR templates and AI policy. Check whether assignment, a design proposal, CLA or human sign-off is required. Explain legal attestations; never sign them for someone.
9
+ 3. Search existing issues, merged and open PRs, and recent release notes. If someone owns the work, do not duplicate it. Prefer a wanted, bounded fix with an observable test, including documentation or accessibility defects when useful.
10
+ 4. Follow the project's environment instructions. Explain fork (your copy), branch (isolated changes), commit (saved revision), and PR (request to incorporate changes) as needed. Preserve uncommitted user work; do not prescribe destructive resets.
11
+ 5. Run the smallest baseline reproduction before changing code. Save the exact command, environment, revision and observed result. Distinguish environment failures from product defects.
12
+
13
+ ## Issue triage and proposals
14
+
15
+ Read the entire changed discussion and linked evidence before interpreting a maintainer request. Separate expected behavior, observed behavior and hypothesis. A useful issue draft contains version/platform, minimal reproducer, expected/actual result, relevant sanitized output and duplicate search. Do not publish security-sensitive reports through a normal public issue; follow SECURITY.md and disclosure policy.
16
+
17
+ For a larger change, propose scope and compatibility before implementation when the project requires it. Explain alternatives and trade-offs, not just the favored design. Do not equate issue activity or an emoji with permission or assignment.
18
+
19
+ ## Implement and open a PR
20
+
21
+ Follow the main skill's red/green and final-head verification steps. Start with a narrowly scoped behavior change, add repository-appropriate tests, and update relevant docs/changelog. For public interfaces consider backward compatibility, accessibility, platform support, performance/resource cost and security. A refactor needs its own justification.
22
+
23
+ Before publication, review the full diff and commit content for generated noise, secrets, private paths and unrelated edits. Check licensing and provenance of copied code. Prepare the repository's PR template truthfully. State unrun checks explicitly. Only publish when the user authorized it; draft-first does not remove that requirement.
24
+
25
+ ## Comments and communication
26
+
27
+ Draft first unless sending is explicitly authorized. Match repository tone and terminology, stay concise, and avoid mass pings or synthetic progress updates. Do not claim personal understanding, manual testing or human authorship that has not occurred. Mark AI assistance when required; a policy requiring substantial human input cannot be satisfied by approving an AI-only message.
28
+
29
+ Use these as structures, not automatically posted text:
30
+
31
+ - **Clarify scope:** “I can reproduce [observed behavior] on [version]. Before changing [interface], is [bounded behavior] the intended contract?” Only state reproduction if verified.
32
+ - **Respond to a review:** “Changed [specific point] in [commit]. [Exact test] now covers [behavior]. [Remaining limitation].” Link evidence; do not resolve a thread merely because a reply was posted.
33
+ - **Disagree constructively:** “I see the concern about [trade-off]. [Evidence] suggests [constraint]. Would [alternative] address it without [documented regression]?” Acknowledge what is unknown.
34
+ - **Blocked:** “[Check] cannot run because [observed error]. [Other checks] passed on [head]. The missing verification is [specific step].” Avoid presenting a workaround as permission to bypass a gate.
35
+ - **Declined or superseded:** Thank the maintainer briefly if a response is warranted and authorized, record the outcome, and stop the declined line of work. Do not debate for credit or reopen automatically.
36
+
37
+ For every review point, track requested change → code or explanation → evidence → unresolved/resolved status. Distinguish blocking review, suggestion, question and automated finding. Re-read materially edited comments. Do not pressure maintainers or use arbitrary follow-up quotas; respect explicit cadence and stop requests.
38
+
39
+ ## Experienced contributors and maintainers
40
+
41
+ For architecture or multi-package changes, document invariants, migration/rollback strategy, consumer wiring and release implications. Keep security, compatibility and resource budgets explicit. Prefer staged changes only when each is independently useful, not to manufacture activity. Review others' PRs only with authorization and within project policy; evaluate actual diffs and tests rather than issuing approval from summaries. Never approve as another person or bypass branch protections.
42
+
43
+ After an authorized rebase or conflict resolution, rerun affected checks on the new head. A clean merge or green CI does not establish semantic correctness. Distinguish author-fixable work from maintainer-only workflow/review gates.
44
+
45
+ ## After acceptance or closure
46
+
47
+ Verify native merge metadata or credited destination code separately. Preserve final accepted scope and collaborator credit. Monitor post-merge issues only within an agreed arrangement. A revert or correction is learning evidence, not something to hide. Record rejected, withdrawn and unexplained closures without inventing reasons. Finish the contribution with accurate evidence, not a promise of acceptance.
@@ -0,0 +1,96 @@
1
+ # Evidence method and contribution ledger
2
+
3
+ ## Collect a defensible inventory
4
+
5
+ State the account, contribution types, repositories/namespaces included or excluded, date range, exact query, UTC snapshot time, pagination, and coverage limits. “Every contribution” can include authored PRs, issues, reviews, direct commits, and own-repository work: enumerate those separately when requested and permitted. An authored-upstream-PR query does not establish completeness for those other categories. Do not silently rename a PR-only inventory “all GitHub contributions.”
6
+
7
+ Use all accessible relevant outcomes in the agreed scope rather than only wins. If only a sample is practical, label its selection. Check search result ceilings, per-page totals, incomplete flags, unique IDs, and discussion pagination. See [incremental maintenance](maintenance.md) for growth beyond search caps. Keep held/inaccessible records and collection errors explicit, not zero-filled or omitted. Do not re-read a held source to fill a gap without current authorization.
8
+
9
+ For a specific PR, inspect its metadata, current head and base, diff, linked issue, reviews, inline comments, discussion, and checks. Read current repository policy before acting on a historical case. A complete inventory and discussion assessment is not a complete code audit or a rerun of every test suite.
10
+
11
+ Record evidence provenance: author claim, CI/check output, automated or AI-assisted review, verified maintainer statement, independently reproduced test, or verified landed commit. Preserve unknown identity and automation status. A different account, reviewer badge, or positive review alone does not prove a human maintainer ran the tests. Prefer exact comment permalinks for review claims. Treat any old ledger wording about “human feedback” as historical classification, not verified actor identity.
12
+
13
+ ## Separate lifecycle, disposition, and quality
14
+
15
+ Keep three independent dimensions:
16
+
17
+ 1. **Lifecycle:** `github_merged`, `open`, or `closed_without_github_merge`, based on native metadata.
18
+ 2. **Disposition:** full credited landing elsewhere; partial incorporation; superseded/duplicate; explicit withdrawal; documented rejection/out-of-scope; inferred reason; explicit stale closure; or unresolved. Keep the evidence and confidence for each reason.
19
+ 3. **Post-landing quality:** unknown, no known correction in checked sources, correction reported, correction verified, reverted, or repaired. Do not erase a genuine merge because a later defect is reported, or let a merge badge hide the defect. Absence of reports is not proof of correctness.
20
+
21
+ For an outside landing, verify equivalent code in the destination commit/PR and contributor credit. If only a comment claims landing, say “reported landing; destination not verified.” Distinguish full and partial incorporation, record the final scope, and credit maintainer follow-ups. Link ports/backports and destination PRs so the same change is not double-counted. PR-record totals are not necessarily unique fixes.
22
+
23
+ Do not infer rejection from closure, infer cause from timing, or spread a cohort-level statement to every PR in a repository. Explicitly distinguish direct evidence, bounded inference, and unresolved explanation. Keep native merges, additional full landings, partial credit, and a goal-specific company allowlist separate. Organization account type is not evidence of company eligibility.
24
+
25
+ ## Preserve a usable per-PR ledger
26
+
27
+ The bundled `assets/example-ledger.json` contains synthetic `metadata` and `records` for a smoke test. Store real evidence in an authorized private location. Query ledgers with `scripts/ledger.py` rather than loading them wholesale.
28
+
29
+ Use one current record per immutable `pull_request_node_id`; retain canonical `url`, `repository`, and `number` for navigation. Keep `issue_id` (REST issue identity) distinct from `pull_request_id` (REST PR identity); unknown IDs stay null. Keep renamed/moved repository aliases associated with the immutable ID.
30
+
31
+ Preserve existing fields and annotations. Important baseline fields include:
32
+
33
+ - `author`, `title`, `created_at`, `updated_at`, `closed_at`, `merged_at`.
34
+ - `github_lifecycle`, `disposition`, `disposition_confidence`.
35
+ - `discussion_coverage`, `discussion_entry_count`.
36
+ - `merge_commit_sha`, `landing_commit_url`, `landing_commit_sha`, `verified_credit`.
37
+ - `research_note`, `evidence_urls`; optional owner/account and explicitly scoped goal fields.
38
+
39
+ Add structured observations when useful rather than replacing history with a single favorable summary:
40
+
41
+ ```json
42
+ {
43
+ "observed_at": "UTC snapshot timestamp",
44
+ "sampled_head_sha": null,
45
+ "positive": {
46
+ "observation": "A directly supported strength",
47
+ "evidence_urls": [],
48
+ "source_kind": "verified_test | reported_test | comment | commit | check",
49
+ "confidence": "direct | supported_inference | unverified"
50
+ },
51
+ "improvement": {
52
+ "feedback": "Specific friction or review request",
53
+ "evidence_urls": [],
54
+ "change_made": null,
55
+ "verification": null,
56
+ "status": "proposed | implemented_unverified | verified | not_applicable"
57
+ },
58
+ "verification": {
59
+ "base_sha": null,
60
+ "tested_head_sha": null,
61
+ "red": "not_run",
62
+ "green": "not_run",
63
+ "mutation": "not_run",
64
+ "required_checks": "unknown",
65
+ "commands_and_results": []
66
+ },
67
+ "post_landing": {
68
+ "status": "unknown",
69
+ "checked_at": null,
70
+ "evidence_urls": [],
71
+ "correction_or_revert_url": null
72
+ },
73
+ "related_contributions": [],
74
+ "interpretation": null,
75
+ "next_experiment": null,
76
+ "next_action": null,
77
+ "blocker": null
78
+ }
79
+ ```
80
+
81
+ Store dynamic ledgers only in an authorized private task location. Do not publish account-wide retrospectives or private feedback upstream by default. Keep secrets and unnecessary personal data out. If maintaining a historical event log, keep it separate from the one-row-per-PR current view and deduplicate events by source identity/version.
82
+
83
+ ## Analyze and report without overclaiming
84
+
85
+ For each pattern, identify distinct PRs and repositories, counterexamples, confounding context, and what is independently verified. Separate observation → interpretation → next experiment. Report the strongest demonstrated positive, the improvement made, remaining friction, and a concrete action. Do not convert a plausible test into proven regression detection or credit all final quality to the original patch.
86
+
87
+ Measure useful outcomes when available: substantive review response, requested versus unnecessary revision, verification gaps closed, and post-merge corrections. Do not reward comment counts, PR volume, or repeated pings. Acceptance rate is descriptive only with a justified complete denominator, observation window and clearly separated open work; this history supports no causal effect or acceptance probability.
88
+
89
+ ## Read-only helpers
90
+
91
+ - `collect_pr_evidence.py OWNER/REPO NUMBER --output NEW_PATH` uses authenticated `gh api --method GET`. It collects PR metadata, paginated comments/reviews/commits, and check-runs/statuses for a sampled head. An initial failure creates no file; later failures save a marked partial result with nonzero status. A head change during collection is flagged. Commit-list length is checked against PR metadata because pagination can still cap the endpoint at 250 commits; incomplete or unknown coverage is marked partial. It does not fetch policy, diffs, check logs, or independently verify reported tests. Use an available connector when `gh` authentication is absent; do not change credentials just for the helper.
92
+ - `ledger.py summary PATH` validates record identities and computes descriptive totals. It reports recorded coverage, not independent verification of the underlying claims.
93
+ - `ledger.py show PATH --repository OWNER/REPO --number N` extracts one local row.
94
+ - `ledger.py diff OLD NEW --output NEW_PATH` compares local snapshots without altering either, preserving added, changed, and absent records. An absent record is a reconciliation warning, not permission to delete it. Output files must be new; none are overwritten.
95
+
96
+ New helper output files use exclusive creation and owner-only mode `0600` on POSIX. Windows uses different ACL semantics; verify the destination access controls there before storing private evidence. These helpers do not configure Windows ACLs.
@@ -0,0 +1,35 @@
1
+ # Maintain contribution learning as work evolves
2
+
3
+ ## Keep data, guidance, and automation separate
4
+
5
+ - **Ledger:** dated observations for individual immutable contribution identities. Refresh new comments, review changes, heads, checks, lifecycle, landing evidence, and post-merge corrections.
6
+ - **Skill:** reusable decision guidance. Change it when an evidenced lesson changes a future decision, preserving source and uncertainty. Do not add a universal rule for every anecdote.
7
+ - **Automation:** a separately configured, verified schedule or event source. The existence of this skill does not schedule anything. A user request for skill updates does not grant posting, code changes, pushes, PR creation, or merges in upstream repositories.
8
+
9
+ The bundled example ledger is synthetic, not a research baseline or maintained database. For ongoing work, use an authorized private location or an existing user-approved ledger. Keep any separately established research baseline intact and save dated working snapshots there. Read current permissions and source restrictions before each refresh; a historical held-source marker is neither new permission nor a substitute for current instructions.
10
+
11
+ ## Incremental refresh
12
+
13
+ 1. Read the last successful checkpoint and its coverage. If none exists, establish a baseline for the agreed scope, including contribution types and account. Confirm the source is accessible before promising monitoring.
14
+ 2. Search for **updated**, not only created or merged, contributions since the last successful checkpoint, with a modest overlap for indexing delays. Include all lifecycle states so a comment on an old merged PR is not missed. Recheck outstanding open items relevant to current work. Deduplicate with immutable PR node IDs.
15
+ 3. Page each result and each required discussion stream fully. Record totals, retrieval errors, inaccessible/held records, and `incomplete_results`. If a search approaches GitHub's 1,000-result limit, partition into disjoint creation-date ranges and subdivide any saturated range; validate boundary coverage and deduplicate identities. If one partition still cannot be enumerated, report the coverage gap or use a supported repository/listing endpoint. Never call a capped query complete.
16
+ 4. Refresh only changed permitted items and the evidence needed to understand them. Respect rate limits and bounded retries; do not retry access denials through another identity or tool. Preserve the last known record if a source becomes unavailable. Do not erase a record because it disappeared from one query.
17
+ 5. Reconcile lifecycle separately from code disposition and post-landing quality. Verify equivalent landed code and credit, not only a closure comment. Keep partial incorporation distinct from full landing. Preserve links between a source PR, destination PR/commit, ports, and backports so a single change is not counted twice.
18
+ 6. Compare snapshots using `python3 scripts/ledger.py diff OLD NEW --output NEW_FILE`. This helper reports changes; it never rewrites the ledger or resolves conflicting evidence. Investigate unexpected count decreases, changed immutable identities, duplicate records, and inconsistent lifecycle/disposition before publishing totals.
19
+ 7. Advance the **complete checkpoint** only through an interval whose permitted retrieval finished. A partial attempt can retain successful rows and a retry list, but must not silently skip its failed interval later. Record the snapshot's observation time separately from GitHub event times.
20
+ 8. Periodically reconcile the full agreed inventory in addition to incremental queries, at a cadence justified by activity and API cost. Revalidate a live PR before taking action; a scheduled snapshot is not action-time verification.
21
+
22
+ ## Useful triggers and bounded responses
23
+
24
+ - **New substantive review:** map each required point to the relevant change/evidence; report blockers requiring the user. Do not automatically reply.
25
+ - **Head changed:** invalidate prior readiness conclusions for changed code; check final-head verification and review requirements.
26
+ - **Merged or credited landing:** verify destination, final scope, credit, and deduplication. Update status, not a quality guarantee.
27
+ - **Post-merge correction, revert, or vulnerability report:** retain historical acceptance and record current quality/repair status separately. Verify severity before an urgent message; do not automatically publish a vulnerability or modify upstream code.
28
+ - **Repeated failure or new policy constraint:** update the reusable lesson with evidence and proper scope, then rerun skill validation and relevant behavioral tests before saving.
29
+ - **No substantive change:** save coverage/checkpoint if appropriate; no empty user update or maintainer nudge.
30
+
31
+ For an ongoing arrangement, prefer a modest agreed cadence and event-driven refresh where supported. A weekly read-only check is a reasonable option to propose for this history; it is not a schedule already running. More frequent checks should be justified by active review or a deadline. Batch nonurgent user findings, honor explicit reviewer limits, and avoid mass submissions or automated green-CI messages.
32
+
33
+ ## Refresh the skill safely
34
+
35
+ Use the supported personal-skill workflow, resolve the skill by its frontmatter name, preserve UI policy/dependencies, and update only this skill. Keep raw history in the approved ledger, with focused sourced examples in references. Run structure validation, helper tests, and independent task scenarios for meaningful behavior changes. Verify the saved remote content before claiming the update is available. Do not infer that saving a cloud/personal skill installs it into a desktop-local skills folder.
@@ -0,0 +1,10 @@
1
+ # Reproduction and final validation
2
+
3
+ 1. Reproduce the reported behavior against a recorded base revision. Separate observed failure, expected contract, and root-cause hypothesis. Trace real consumer wiring and existing helpers. Compare the reported failing invocation with the actual CI commands and record any gap in entry-point coverage. Distinguish a supported upstream defect from a local setup failure or already-fixed release.
4
+ 2. For a behavioral code fix, design regression evidence that observes the promised behavior, not merely an implementation detail. Follow the repository’s test policy: use its supported harness and, where a committed test suite is disallowed, a permitted reproduction or validation instead. Do not force test infrastructure onto a bounded docs or data fix. Run the same behavioral check against the unfixed base and fixed tree. Verify it fails for the intended reason before the fix, then passes after it. If practical, revert only the fix or use a targeted mutation to check that the assertion detects the defect. Preserve the working tree and user changes.
5
+ 3. Preflight the intended runtime or tool executable and version; a command name alone does not establish toolchain identity. Verify the executed or imported code comes from the intended checkout, not a stale installed release. If red/green execution is blocked, label it unverified and describe the exact missing dependency or environment. Do not turn a plausible test or green-only run into proven regression coverage.
6
+ 4. Validate the actual contract rather than a convenient proxy: visibility rather than mounted text, authenticated versus logged-out flows when relevant, real supported platforms rather than a renamed fixture, and actual consumer/API behavior rather than disconnected helper tests. When a change promises callback or event side effects, assert those effects as well as visible state. Do not claim first-hand account testing you could not perform. Measure added per-item/network work where relevant. Preserve authentication, authorization, replay protection, resource bounds, and data integrity; stop or narrow a design that weakens them. Use supported security reporting instead of publicly exposing sensitive vulnerability details.
7
+ 5. Keep the patch aligned with project conventions and feedback, including compatibility, ownership, naming, docs, changelog, and release notes when required. Avoid unrelated refactors, speculative hardening, and duplicate fixes.
8
+ 6. Run relevant tests, lint, type checks, formatting, and required aggregate checks against the final revision. Record commands, outcomes, scope, and head SHA. Distinguish pass, fail, blocked, not run, skipped, neutral, and pending. Green focused tests do not imply full CI success.
9
+ 7. Review the diff independently when warranted or required. Distinguish author claims, CI results, bot/AI-assisted reviews, verified maintainer direction, and independently reproduced evidence. A non-author account is not automatically human or a maintainer. Do not present automated review as maintainer approval. Verify remote checks and review disposition on the latest head; an earlier pass does not certify later changes. Do not claim readiness with unanswered blocking feedback, required checks missing, or policy gates unresolved.
10
+
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env python3
2
+ """Save a read-only GitHub PR evidence snapshot using authenticated gh."""
3
+ import argparse
4
+ import datetime as dt
5
+ import json
6
+ import os
7
+ import re
8
+ import subprocess
9
+ import sys
10
+ from pathlib import Path
11
+
12
+
13
+ class CollectionError(RuntimeError):
14
+ pass
15
+
16
+
17
+ def api(endpoint, paginated=False):
18
+ command = ["gh", "api", "--hostname", "github.com", "--method", "GET", endpoint]
19
+ if paginated:
20
+ command.append("--paginate")
21
+ try:
22
+ result = subprocess.run(command, capture_output=True, text=True, timeout=120)
23
+ except (OSError, subprocess.TimeoutExpired) as exc:
24
+ raise CollectionError(f"GitHub read failed: {type(exc).__name__}") from exc
25
+ if result.returncode:
26
+ # Preserve useful diagnostics without collecting credentials or environment.
27
+ raise CollectionError((result.stderr.strip() or "gh api failed")[:600])
28
+ try:
29
+ if not paginated:
30
+ return json.loads(result.stdout)
31
+ # Older gh versions emit consecutive JSON values and have no --slurp.
32
+ remainder = result.stdout.lstrip()
33
+ if not remainder:
34
+ raise CollectionError("gh returned no pagination data")
35
+ decoder = json.JSONDecoder()
36
+ result_pages = []
37
+ while remainder:
38
+ page, end = decoder.raw_decode(remainder)
39
+ result_pages.append(page)
40
+ remainder = remainder[end:].lstrip()
41
+ return result_pages
42
+ except json.JSONDecodeError as exc:
43
+ raise CollectionError("gh returned invalid JSON") from exc
44
+
45
+
46
+ def pages(endpoint, key=None):
47
+ data = api(endpoint + "?per_page=100", paginated=True)
48
+ if not isinstance(data, list):
49
+ raise CollectionError("Expected a paginated JSON array")
50
+ flattened = []
51
+ for page in data:
52
+ rows = page.get(key) if key and isinstance(page, dict) else page
53
+ if not isinstance(rows, list):
54
+ raise CollectionError(f"Unexpected pagination shape for {endpoint}")
55
+ flattened.extend(rows)
56
+ return flattened
57
+
58
+
59
+ def collect(repo, number):
60
+ route = f"repos/{repo}/pulls/{number}"
61
+ pr = api(route)
62
+ if not isinstance(pr, dict) or not isinstance(pr.get("head"), dict):
63
+ raise CollectionError("Initial PR metadata is missing a head")
64
+ sha = pr["head"].get("sha")
65
+ if not isinstance(sha, str) or not re.fullmatch(r"[0-9a-fA-F]{40,64}", sha):
66
+ raise CollectionError("Initial PR metadata has an invalid head SHA")
67
+ snapshot = {
68
+ "schema_version": 1,
69
+ "repository": repo,
70
+ "number": number,
71
+ "sampled_head_sha": sha,
72
+ "started_at": dt.datetime.now(dt.timezone.utc).isoformat(),
73
+ "pr": pr,
74
+ "sections": {},
75
+ "errors": {},
76
+ }
77
+ endpoints = {
78
+ "issue_comments": (f"repos/{repo}/issues/{number}/comments", None),
79
+ "reviews": (route + "/reviews", None),
80
+ "review_comments": (route + "/comments", None),
81
+ "commits": (route + "/commits", None),
82
+ "check_runs": (f"repos/{repo}/commits/{sha}/check-runs", "check_runs"),
83
+ "commit_statuses": (f"repos/{repo}/commits/{sha}/statuses", None),
84
+ }
85
+ for section, (endpoint, key) in endpoints.items():
86
+ try:
87
+ snapshot["sections"][section] = pages(endpoint, key)
88
+ except CollectionError as exc:
89
+ snapshot["errors"][section] = str(exc)
90
+ if "commits" in snapshot["sections"]:
91
+ expected_commits = pr.get("commits")
92
+ collected_commits = len(snapshot["sections"]["commits"])
93
+ if not isinstance(expected_commits, int) or isinstance(expected_commits, bool) or expected_commits < 0:
94
+ snapshot["errors"]["commits_coverage"] = "PR metadata commit count is unavailable; full commit coverage is not established."
95
+ elif collected_commits != expected_commits:
96
+ snapshot["errors"]["commits_coverage"] = (
97
+ f"Collected {collected_commits} of {expected_commits} reported commits. "
98
+ "The PR commits endpoint can cap results at 250; history is not complete."
99
+ )
100
+ try:
101
+ ending = api(route)
102
+ if not isinstance(ending, dict) or not isinstance(ending.get("head"), dict):
103
+ raise CollectionError("Final PR metadata is missing a head")
104
+ snapshot["ending_pr"] = {
105
+ field: ending.get(field)
106
+ for field in ("state", "merged", "merged_at", "closed_at", "draft", "merge_commit_sha")
107
+ }
108
+ snapshot["ending_head_sha"] = ending["head"].get("sha")
109
+ snapshot["head_changed_during_collection"] = sha != snapshot["ending_head_sha"]
110
+ if snapshot["head_changed_during_collection"]:
111
+ snapshot["errors"]["head"] = "Head changed during collection; refresh before assessing checks."
112
+ except CollectionError as exc:
113
+ snapshot["errors"]["ending_pr"] = str(exc)
114
+ snapshot["finished_at"] = dt.datetime.now(dt.timezone.utc).isoformat()
115
+ snapshot["collection_complete"] = not snapshot["errors"]
116
+ return snapshot
117
+
118
+
119
+ def main(argv=None):
120
+ parser = argparse.ArgumentParser(description=__doc__)
121
+ parser.add_argument("repository", help="GitHub OWNER/REPO")
122
+ parser.add_argument("number", type=int, help="Positive PR number")
123
+ parser.add_argument("--output", required=True, type=Path, help="New private snapshot file; never overwritten")
124
+ args = parser.parse_args(argv)
125
+ if not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9_.-]+", args.repository) or args.number < 1:
126
+ parser.error("Provide OWNER/REPO and a positive PR number")
127
+ if args.output.exists():
128
+ parser.error("Output already exists; choose a new file")
129
+ try:
130
+ result = collect(args.repository, args.number)
131
+ with os.fdopen(os.open(args.output, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600), "w", encoding="utf-8") as output:
132
+ json.dump(result, output, ensure_ascii=False, indent=2)
133
+ output.write("\n")
134
+ except (CollectionError, OSError) as exc:
135
+ print(f"Snapshot failed: {exc}", file=sys.stderr)
136
+ return 1
137
+ print(f"Saved {'complete' if result['collection_complete'] else 'partial'} snapshot: {args.output}")
138
+ if result["errors"]:
139
+ print("Incomplete sections: " + ", ".join(result["errors"]), file=sys.stderr)
140
+ return 2
141
+ return 0
142
+
143
+
144
+ if __name__ == "__main__":
145
+ sys.exit(main())