agentleFS
docxologydocxology/template/.github/AGENTS.md

template

AGENTS.md20 starsChanged 3 months agoApache-2.0View on GitHub

The .github/ directory contains GitHub-specific configuration and automation for the Research Project Template. This includes continuous integration workflows, issue templates, PR templates, and other GitHub integrations that ensure code quality and collaborative development. Human entry point: README.md — GitHub overview, doc map, and Agent & automation entry point. This file (AGENTS.md): job names, paths, and thresholds for automation and agents. Title: A template/ approach to Reproducible Generative Research: Architecture and Ergonomics from Configuration through Publication DOI: 10.5281/zenodo.19139090 Record: zenodo.org/records/19139090 License:…

  • Commits and pushes

The file

Files
AGENTS.md

GitHub Integration

Overview

The .github/ directory contains GitHub-specific configuration and automation for the Research Project Template. This includes continuous integration workflows, issue templates, PR templates, and other GitHub integrations that ensure code quality and collaborative development.

Human entry point: README.md — GitHub overview, doc map, and Agent & automation entry point. This file (AGENTS.md): job names, paths, and thresholds for automation and agents.

Publication

Title: A template/ approach to Reproducible Generative Research: Architecture and Ergonomics from Configuration through Publication DOI: 10.5281/zenodo.19139090 Record: zenodo.org/records/19139090 License: Apache 2.0

Public exemplar GitHub/Zenodo records are generated into .github/README.md from ../docs/_generated/publication_records.md. Refresh them with:

uv run python scripts/docgen/publication_records.py --refresh-external

Directory Structure

flowchart TB
    GH[.github/]
    GH --> META[AGENTS.md · README.md]
    GH --> DEP[dependabot.yml<br/>Automated dependency updates]
    GH --> PRT[PULL_REQUEST_TEMPLATE.md]
    GH --> ITPL[ISSUE_TEMPLATE]
    GH --> WF[workflows]

    ITPL --> ITPL_DOCS[AGENTS.md · README.md]
    ITPL --> ITPL_F[config.yml · bug_report.md ·<br/>feature_request.md · documentation.md]

    WF --> WF_DOCS[AGENTS.md · README.md]
    WF --> WF_CI[ci.yml<br/>19 jobs — 2 conditional via detect outputs — fep-lean, setup-hook-windows-smoke — 2 schedule/dispatch-only — public-matrix-receipt, test-infra-slow — 1 aggregation gate — ci-gate]
    WF --> WF_STALE[stale.yml<br/>Auto-label/close stale issues/PRs]
    WF --> WF_REL[release.yml<br/>GitHub Releases on version tags]
    WF --> WF_DA[dependabot-automerge.yml<br/>Auto-merge safe Dependabot PRs]

    classDef d fill:#0f172a,stroke:#0f172a,color:#fff
    classDef pkg fill:#1e3a8a,stroke:#0f172a,color:#fff
    classDef f fill:#0f766e,stroke:#0f172a,color:#fff
    class GH d
    class ITPL,WF pkg
    class META,DEP,PRT,ITPL_F,WF_DOCS,WF_CI,WF_STALE,WF_REL f

Continuous Integration (CI/CD)

CI Pipeline (workflows/ci.yml)

Triggers: push to main, pull requests targeting main, weekly scheduled run (Sunday midnight UTC), manual workflow_dispatch (no inputs). Concurrency: Superseded PR runs are cancelled by PR ref. Main pushes, scheduled runs, and manual runs each retain a unique run group so later commits cannot cancel exact-commit verification.

Pipeline jobs (job ids in ci.yml; display names differ — use name: for branch protection):

19 jobs total; 2 are conditional on push/PR (fep-lean, setup-hook-windows-smoke), gated by the detect job's outputs (needs.detect.outputs.*) — NOT a job-level hashFiles() (that is invalid in a job if: and rejects the whole workflow at parse). 2 further jobs (public-matrix-receipt, test-infra-slow) run only on the weekly schedule or manual dispatch.

#Job idDisplay name (representative)Depends onPythonRunner
1detectDetect optional projects——ubuntu (always)
2detect-projectsDetect public capability matrix—manifest-owned 3.10 + 3.14ubuntu (always)
3actionlintActionlint——ubuntu (always)
4lintLint & Type Check—3.14ubuntu
5healthStatic Health Reportlint3.14ubuntu
6verify-no-mocksVerify No Mocks Policy— (parallel with lint)3.14ubuntu
7setup-hook-windows-smokeSetup hook (Windows smoke)verify-no-mocks, detect3.14windows · runs iff needs.detect.outputs.setup_hook == 'true'
8test-infraInfra Tests (matrix)verify-no-mocks, detect-projects3.10–3.14ubuntu (×3.10/3.11/3.12/3.13/3.14) + macOS (3.14 only) — 6 cells; PR lanes run only ubuntu+macOS 3.14 (CI-FAST-INFRA-COMPAT-1 — dynamic infra_matrix output from detect-projects)
9test-regressionRegression Tier (claim-binding pins)verify-no-mocks3.14ubuntu
10test-projectProject Tests (per-project matrix)verify-no-mocks, detect-projectscapability-manifest versionsubuntu only — exact project/Python include matrix from public_capabilities.py
11fep-leanfep_lean (gauss + lake)verify-no-mocks, detect3.14ubuntu · runs iff needs.detect.outputs.fep_lean == 'true'
12validateValidate Manuscriptslint3.14ubuntu
13securitySecurity Scanlint3.14ubuntu
14docs-lintDocumentation Lintlint3.14ubuntu
15performancePerformance Check— (no needs:; CI-FAST-PERF-1)3.14ubuntu
16public-matrix-receiptPublic Matrix Receipt (receipt-bearing full matrix)—3.14ubuntu · schedule/manual only
17test-infra-slowInfra Slow Lane (pytest.mark.slow)verify-no-mocks3.14ubuntu · schedule/manual only — exercises the slow-marked suite PR lanes deselect
18test-integrationIntegration Tier (run.sh + pipeline CLI)verify-no-mocks3.14ubuntu — runs the registered tests/integration/ suite on every push/PR (CI-WIRING-1)
19ci-gateCI Gateall 18 upstream jobs (if: always())—ubuntu · aggregation — fails if any upstream job failed or was cancelled; skipped counts as intentional

Lint job also runs uv run python -m infrastructure.skills check-all-exports (MED5 __all__ gate), scripts/audit/check_tracked_generated_artifacts.py (rejects generated outputs and local .codegraph/ indexes), scripts/audit/check_template_drift.py --strict (exemplar doc/script drift against Layer-1 contracts), and scripts/audit/check_tracked_all.py — the confidentiality guard that fails CI if any path outside the public allowlists for projects/, fonds/, rules/, or tools/ is git-tracked (this is a public repo; confidential/rotating resources are local-only). validate runs manuscript markdown validation (one dir per invocation, looped over projects/*/manuscript/), scripts/docgen/api_reference.py --check, and imports each projects.{name}.src. security runs blocking pip-audit (IDs from .github/pip-audit-ignore.txt, up to 3 retries on failure) and bandit -c bandit.yaml -r -ll over infrastructure/, scripts/, and projects/. Path exclusions (projects/working/, projects/ongoing/, projects/published/, projects/archive/, projects/other/, plus .venv, site-packages, .lake, the vendored infrastructure/steganography/kmyth submodule, and named rotating research projects such as projects/BeeStack — not the rendered projects/active/ mirror) live in bandit.yaml (exclude_dirs).

Display name (branch protection): the optional fep_lean job is reported as fep_lean (gauss + lake) (ci.yml name: on job id fep-lean). It runs only when the detect job sets fep_lean == 'true' (if: needs.detect.outputs.fep_lean == 'true') — a job-level hashFiles() is invalid in a job if: and would reject the whole workflow at parse, which is why the detect job exists. When fep_lean lives under projects/working/, detect reports false and the job is skipped. Promote with mv projects/working/fep_lean projects/active/fep_lean to activate CI. Branch protection must NOT mark the two conditional jobs (fep-lean, setup-hook-windows-smoke) as required — they are skipped (not failed) when their project is absent, so requiring them would wedge every PR.

Infrastructure and project coverage are uploaded to Codecov only from their Python 3.14 / ubuntu-latest cells; upload failures do not fail CI.

The verify-no-mocks job runs scripts/audit/verify_no_mocks.py at the repository root (not under .github/).

Stale Workflow (workflows/stale.yml)

Runs daily. Issues → stale after 60 days, closed after 14 more. PRs → stale after 30 days, closed after 14 more. Exempt labels: pinned, security, in-progress, blocked, do-not-close.

Release Workflow (workflows/release.yml)

Triggered by v*.*.* tag pushes or manual dispatch with a tag. It resolves the requested tag before checkout, checks out that exact ref, proves HEAD matches the dereferenced tag commit, runs the root release contract, and then runs the bounded pipeline-smoke infra test lane plus no-mocks gate on the tagged SHA (executable test evidence without the per-commit full matrix), the fail-closed capability manifest, credential-free clean-export package/import smoke, and strict rendered publication audit across the canonical public roster. Those gates require valid source/package contracts, standalone imports, and current rendered co-snapshot receipts before distributions are built. The release uses softprops/action-gh-release@v3.0.2, writes a short git-log excerpt to body_path, and keeps generate_release_notes off so GitHub does not duplicate the body.

Dependabot Automerge Workflow (workflows/dependabot-automerge.yml)

Triggered by pull_request_target on Dependabot PRs only (github.actor == 'dependabot[bot]'). Enables GitHub native auto-merge (gh pr merge --auto --squash) for semver-minor and semver-patch updates. Major bumps are left for human review. The workflow never checks out or executes PR HEAD code — it only reads update metadata and calls the GitHub API — so the elevated pull_request_target trigger does not expose secrets to untrusted code. Auto-merge must also be enabled in repository settings (Settings → General → "Allow auto-merge").

Dependabot (dependabot.yml)

dependabot.yml at the repository root: GitHub Actions (package-ecosystem: github-actions, directory: /) and Python (package-ecosystem: pip, directory: /) both read the root pyproject.toml / lockfile — compatible with uv. Weekly Monday 09:00 UTC, max 5 open PRs per ecosystem. Groups: actions-minor (Actions minor/patch), dev-tools and scientific-core (Python).

Quality Gates

GateThreshold
Ruff lintzero violations
Ruff formatzero diffs
mypy strict gatezero errors across the generated public source scope
Mock-framework lexical gatezero prohibited imports/calls (--inventory debt remains advisory)
Public capability parityexact public roster and CI matrix; unique normalized package identities; complete moving-patch Python series; parseable source/tests; compiled/confined direct hydration; reason-bearing skips
Infrastructure coverage≥ 60%
Project coverage (per-project standalone)≥ 90%
Combined-union public-project gate (DEFAULT_FAIL_UNDER)≥ 75% via local scripts/pipeline/stage_01_test.py --project-only --all-projects --public-projects (CI test-project enforces per-exemplar 90% only)
pip-auditzero known vulns not listed in .github/pip-audit-ignore.txt
Bandit MEDIUM+ (-c bandit.yaml)zero findings
Mermaid diagrams render under mmdczero failures
Markdown cross-links resolve on diskzero broken links
Permanent-template folders carry AGENTS.md + README.mdzero missing pairs
N Python (sub)packages claims match realityzero stale counts
Rotating projects in long-lived docs are conditionalzero ghost references
Import time≤ 5 s
Module line count (scripts/gates/module_line_count_check.py)warn ≥ 800 / fail ≥ 950 for infrastructure/ + scripts/; warn ≥ 150 / fail ≥ 250 for projects/*/scripts/

Local Pre-Push Parity (.pre-commit-config.yaml)

The repo ships a .pre-commit-config.yaml with seven pre-push hooks that mirror (or partially mirror) CI gates so pushes that would fail CI fail locally first:

Hook idMirrors CI stepTypical runtime
pre-push-quickverify-no-mocks + check_tracked_all + tests/infra_tests/git_hook_smoke/~3 s
docs-contract-guardcheck_template_drift.py --strict + AGENTS personal-memory test~5 s
bandit-quicksecurity job Bandit step (-c bandit.yaml -r -ll)~5–30 s
skills-checkinfrastructure.skills check (manifest freshness)<1 s
operations-checkinfrastructure.skills operations-check (operation-manifest freshness)<1 s
all-exports-checkinfrastructure.skills check-all-exports (lint job MED5 gate)<1 s
skill-reachability-checkdocs-lint skill front-door and index completeness gate<1 s

The lint job also runs the deterministic source-only publication audit across the generated public roster:

uv run python -m infrastructure.validation.cli publication-audit --all-public --strict --format json

For release sign-off, add --rendered after running each exemplar's canonical pipeline; that mode makes artifact manifests, evidence registries, and figure registries blocking requirements. Subjective editorial findings remain review_required and are reported without weakening deterministic failures.

The lint hooks (ruff-ci, mypy-ci) run on the pre-commit stage, not pre-push, to keep git commit fast. A separate manual-stage bandit-low hook provides a stricter LOW+MEDIUM+HIGH sweep against bandit.yaml's allow-list — invoke with pre-commit run --hook-stage manual bandit-low. To run the full pre-push gate manually:

pre-commit run --hook-stage pre-push --all-files

A new MEDIUM Bandit finding fails git push locally with the same scope and severity as the CI security job, so contributors hear it before CI does.

Branch Protection (Recommended)

Required checks must match the name: field of each job in workflows/ci.yml. main is currently unprotected, so the contexts below are illustrative. Matrix jobs expand to one check per cell:

  • test-infra → Infra Tests (<os>, Python <ver>) — 6 cells: ubuntu-latest × 3.10/3.11/3.12/3.13/3.14 plus macos-latest × 3.14. Note: on PRs only the two 3.14 cells run (CI-FAST-INFRA-COMPAT-1); requiring the 3.10-3.13 contexts as PR checks would wedge every PR — gate PRs via CI Gate instead.
  • test-project → Project Tests (<project>, py<ver>) — one cell for every entry emitted by the validated capability manifest. Its current canonical versions are py3.10 and py3.14, ubuntu-latest only.

Require the combinations you care about, or use GitHub rulesets that treat required checks flexibly.

required_status_checks:
  contexts:
    - "Lint & Type Check"
    - "Verify No Mocks Policy"
    - "Infra Tests (ubuntu-latest, Python 3.10)"
    - "Infra Tests (ubuntu-latest, Python 3.11)"
    - "Infra Tests (ubuntu-latest, Python 3.12)"
    - "Infra Tests (ubuntu-latest, Python 3.13)"
    - "Infra Tests (ubuntu-latest, Python 3.14)"
    - "Infra Tests (macos-latest, Python 3.14)"
    # test-project expands dynamically: "Project Tests (<project>, py<ver>)"
    # for each live templates/template_* exemplar on py3.10 and py3.14. Examples:
    - "Project Tests (templates/template_active_inference, py3.14)"
    - "Project Tests (templates/template_code_project, py3.10)"
    # ... (one check per exemplar × {py3.10, py3.14})
    # Optional: only when fep_lean job runs (skipped if no lean-toolchain file)
    # - "fep_lean (gauss + lake)"
    - "Static Health Report"
    - "Validate Manuscripts"
    - "Security Scan"
    - "Documentation Lint"
    - "Performance Check"
required_pull_request_reviews:
  required_approving_review_count: 1

Branch protection is an external GitHub control and must also require the Regression Tier (claim-binding pins) check. Changes under the sensitive workflow/configuration paths listed in sensitive-ownership.yaml must receive the generated CODEOWNERS review. The current single-maintainer exceptions are documented in that policy file; they are risk disclosures, not permission to bypass the required status checks or sensitive-area review.

Issue Templates

TemplateLabelsUse for
Bug Reportbug, needs-triageReproducible errors with log output
Feature Requestenhancement, needs-triageNew capabilities and improvements
Documentation Updatedocumentation, needs-triageIncorrect or missing docs

Blank issues are disabled. General questions should go to GitHub Discussions. See ISSUE_TEMPLATE/AGENTS.md for local editing rules.

Troubleshooting

# Fix linting locally
uv run python -m infrastructure.project.public_scope lint-paths | xargs uv run ruff check --fix
uv run python -m infrastructure.project.public_scope lint-paths | xargs uv run ruff format

# Run tests locally (safe macOS coverage lane; CI uses auto on Linux)
COVERAGE_FILE=.coverage.infra uv run pytest tests/infra_tests/ \
  -n 2 --dist loadscope --benchmark-disable \
  --cov=infrastructure --cov-report=term-missing --cov-fail-under=60 \
  --durations=10 \
  -m "not requires_ollama and not requires_docker and not network and not slow and not bench and not benchmark and not performance" \
  --timeout=120
# Uncached serial diagnostic oracle: remove the xdist flags above.
uv sync --group public-exemplars
COVERAGE_FILE=.coverage.project uv run python scripts/pipeline/stage_01_test.py --project-only --all-projects --public-projects --non-strict --include-slow
uv run coverage xml -o coverage-project.xml

# Security scan locally (mirror CI)
IGNORE_ARGS=()
while IFS= read -r raw; do [[ "$raw" =~ ^[[:space:]]*# ]] && continue; line="${raw%%#*}"; line="$(echo "$line" | xargs)"; [ -z "$line" ] || IGNORE_ARGS+=(--ignore-vuln "$line"); done < .github/pip-audit-ignore.txt
uv run pip-audit "${IGNORE_ARGS[@]}"
uv run bandit -c bandit.yaml -r -ll infrastructure/ scripts/ projects/
# Module line count (also in `uv run python -m infrastructure.core.health --gates=module-line-count`):
uv run python scripts/gates/module_line_count_check.py
# Strict LOW+MEDIUM+HIGH sweep against the documented allow-list:
uv run bandit -c bandit.yaml -r --severity-level low infrastructure/ scripts/

# Check workflow status via GitHub CLI
gh workflow list
gh run list --workflow=CI --limit=5
gh run view <run-id> --log

See Also

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.