editorial-guide-ramalama/AGENTS.md
Justin Wheeler aaac637e5f
Some checks failed
CI / checks (push) Has been cancelled
📝 AGENTS: Align workflow and API consent
Update `AGENTS.md` to explicitly forbid AI coding agents from running
`git commit` or `git push` directly, standardizing on staged commands
referencing `/tmp/<harness>/`. Document Justin's personal gitmoji commit
format requirement. Expand the Forgejo API consent workflow to include
the full five-step protocol, explicit verbal overrides, the newline
`<br>` rule, and token scope nuances. Add reference to the
`$LLM_TOKEN_WP_COMMUNITYBLOG` token for WordPress interactions.

Assisted-by: Gemini 3.8 Flash (1M context)
Signed-off-by: Justin Wheeler <jwheel@redhat.com>
2026-10-31 03:16:52 -04:00

8.3 KiB

AGENTS.md

Guidance for AI coding agents working on editorial-guide-ramalama. This is a RamaLama-based Retrieval-Augmented Generation (RAG) editorial assistant for the Fedora Community Blog and Fedora Magazine writing guidelines. Think of this as a README written specifically for coding agents. All AI coding agents must use and maintain AGENTS.md. CLAUDE.md is retired across all Fedora AI/ML SIG repositories; do not create or maintain CLAUDE.md. For human-facing docs, see README.md and CONTRIBUTING.md.

Project overview

  • Purpose: an editorial assistant that reviews draft articles against Fedora publication writing guidelines using a local RAG pipeline.
  • Core tech: RamaLama (RAG build and run), Docling (document conversion and chunking, used internally by RamaLama), a Streamlit front end, and small open-weight GGUF models.
  • Models: Gemma 4 E4B (hf://bartowski/google_gemma-4-E4B-it-GGUF) and Granite 4 Micro 3B (hf://ibm-granite/granite-4.0-micro-GGUF).
  • Artifacts: RAG vector-store images are published to Quay and consumed by the app and CLI.

Repository layout

  • app.py - Streamlit UI (primary entry point for end users)
  • scripts/ - pipeline: fetch_articles.py -> stage_corpus.sh -> build
  • data/ - source corpus (article HTML and guidelines), plus analysis reports
  • models/ramalama_config/ - RamaLama RAG config (ramalama_rag.yaml)
  • notebooks/ - exploration notebook
  • docs/ - guides (QUICKSTART, GUIDE, OPENSHIFT_CRC, COMMUNISHIFT, etc.)

Setup commands

# Install Python dependencies
pip install -r requirements.txt

# RamaLama and Podman must be installed separately
# See: https://github.com/containers/ramalama

Build and run

The RAG flow is two steps. First, build an OCI image from the corpus. Then, run queries against it.

# Build the RAG vector-store image (chunk-size 100 is required for this dataset)
ramalama rag --chunk-size 100 data/source/commblog quay.io/fedora/editorial-guide-ramalama:commblog

# Run a query (prompt is passed via stdin)
ramalama run --rag quay.io/fedora/editorial-guide-ramalama:commblog hf://bartowski/google_gemma-4-E4B-it-GGUF

# Launch the Streamlit app (the intended entry point for end users)
streamlit run app.py

The full pipeline (fetch -> stage -> build) is documented in docs/GUIDE.md.

Important - RamaLama RAG API: the flags --model, --corpus, and --query do not exist. Building uses ramalama rag --chunk-size N <corpus_dir> <oci_image>. Querying uses ramalama run --rag <oci_image> <model> with the prompt on stdin. Do not invent flags.

Chunk size: use --chunk-size 100. Larger values (200+) overflow the embedder's 512-token batch limit on this HTML dataset. Do not change this without testing the build end to end.

Code style

  • Python: follow PEP 8, and keep functions small and readable. This is a small project, so prefer clarity over cleverness.
  • Shell scripts: POSIX-friendly bash, and quote variables.
  • Markdown and all files: use plain ASCII only. Do not introduce ambiguous Unicode characters such as en dashes, em dashes, curly quotes, or arrows. Use - for dashes, straight quotes, and -> for arrows. The Forge review tooling flags these.

To scan a file for ambiguous Unicode before committing:

python3 -c "
import sys
with open(sys.argv[1], encoding='utf-8') as f:
    for i, line in enumerate(f, 1):
        for ch in line:
            if ord(ch) > 127:
                print(f'Line {i}: {repr(ch)} (U+{ord(ch):04X})')
" AGENTS.md

If it prints nothing, the file is clean (pure ASCII).

Testing and verification

There is no formal test suite yet. Before finishing a change, verify what is relevant:

# Confirm a RAG image still pulls and responds
podman pull quay.io/fedora/editorial-guide-ramalama:commblog

# Confirm the app launches without errors
streamlit run app.py

# Confirm pipeline scripts run
python scripts/fetch_articles.py
bash scripts/stage_corpus.sh

Scan any changed file for ambiguous Unicode before committing (see Code style above).

Contribution workflow (agents must follow this)

  • Never push directly to main. Create a branch and open a pull request.
  • Commit workflow: Agents must never run git commit or git push directly. Prompt the user to run commands from within the repository working directory. Never include the git -C <path> flag in generated commands. Present staged commands (git add <files> && git commit --edit --file=/tmp/<harness>/<file>.txt --gpg-sign --signoff) for manual user execution.
  • Sign off commits with DCO (git commit -s). This is encouraged as a best practice, though the FPCA already provides the legal basis.
  • Disclose AI use. Add an Assisted-by: <model> <version> (<context window>) trailer to commits per the Fedora AI-Assisted Contributions Policy.
  • Authentication: push over HTTPS following the Fedora Forge HTTP auth docs.
  • Branch naming: feat/..., fix/..., docs/..., chore/....
  • Commit messages: imperative mood, <component>: <summary> format (note: Justin's personal workflow strictly requires gitmoji: <gitmoji> <component>: <summary>), followed by 3-6 sentences explaining the rationale. Follow the 50/72 Rule strictly. Keep the subject line to 50 characters or fewer (hard limit 72). Hard wrap all commit body lines greedily, filling up to the full 72-character limit per line without premature line breaks (standalone URLs are exempt). Pack as many words as fit on each line before wrapping. Always wrap repository file names, paths, CLI commands, and programmatic identifiers in backticks (`...`). Backtick escapes must open and close on the same line; carry the entire backticked phrase to the next line if it cannot fit within the 72-character limit.
  • One logical change per PR. Reference related issues (e.g. Closes #123).

Mutating API calls on forge.fedoraproject.org must never be run without informed consent. Use bearer token $LLM_TOKEN_FORGEJO_FEDORA (never print or commit token values). When querying the WordPress API for Fedora Community Blog articles, use $LLM_TOKEN_WP_COMMUNITYBLOG.

  1. Write payload files to /tmp/<harness>/ (for example, /tmp/opencode/ when using OpenCode, /tmp/codex/ when using Codex) with descriptive filenames.
  2. Present the full rendered text or unified diff to the user.
  3. Provide copy-pasteable curl or python3 commands referencing the payload file.
  4. Wait for explicit user consent: either manual execution by the user, or an explicit verbal override (e.g., "post it for me") authorizing the agent to run the exact payload presented.
  5. Verify read-only that the change landed as intended.

Formatting and Attribution Rules for Forgejo

  • Newlines: Forgejo renders newlines as <br>. Use continuous paragraphs separated by blank lines instead of one-sentence-per-line in Forgejo issue, PR, or comment bodies.
  • Perspective: API comments post under @jflory7; write in the first person.
  • AI Disclosure: Append <sub>_LLM-gen-AI was used to draft this content, reviewed by @jflory7._</sub> to all posted content. Never name the specific model or vendor in Forgejo posts.
  • Token Scope Nuance: Updating pull requests via /pulls/{index} requires write:repository scope, while /issues/{index} accepts write:issue scope. Review conversation resolution is not supported via API and must be performed in the web UI.

Security and safety notes

  • Do not commit secrets, API tokens, or Quay/robot credentials.
  • The published Quay images are public, so do not embed private data in the corpus.
  • Keep changes to the RAG config (chunk-size, model strings) deliberate and tested, since they directly affect output quality.

Good first pointers for agents

  • End users are meant to use the Streamlit app, not the raw CLI, so keep the app as the primary UX when making changes.
  • When editing docs, keep repo URLs pointing at forge.fedoraproject.org/ai-ml/editorial-guide-ramalama. Leave upstream links (RamaLama, Docling) and Quay image paths as they are unless explicitly migrating them.