From a839c2b7a104e05086ab19d6200dcabd9d6bf7ab Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Wed, 7 Oct 2026 09:28:39 +0200 Subject: [PATCH 1/2] fix: guidelines name the T in the date command assistant-guidelines.md requires prompt files named YYYY-MM-DDTHH-MM-SS-XXX_.txt and stresses that the T matters, but told the model to run `date +%Y-%m-%d%H-%M-%S`, which leaves it out. It now says `date +%Y-%m-%dT%H-%M-%S`, the format both hooks write with strftime. A test pins the documented format, in the .github copy as well as the bundled one, since ./release copies the former over the latter. Prompt: (comment from the review process) fix in [ai-prompt-auto-commit] and make a PR [on a review finding that the guidelines' date command lacks the T its filename pattern demands] Followup-Prompt: [fix review findings] Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox --- .github/assistant-guidelines.md | 2 +- CHANGES.md | 6 ++++ .../data/assistant-guidelines.md | 2 +- tests/test_prepare_repository.py | 28 +++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/assistant-guidelines.md b/.github/assistant-guidelines.md index a8fd9ff..3cb7067 100644 --- a/.github/assistant-guidelines.md +++ b/.github/assistant-guidelines.md @@ -19,7 +19,7 @@ These guidelines tell the assistant exactly how to write prompt files in this re - `HH-MM-SS` is the current time. - `raptor-mini-preview` is the model name. Replace this model name with the actual AI model that you use. - - Use `date +%Y-%m-%d%H-%M-%S` to get the current date and time. + - Use `date +%Y-%m-%dT%H-%M-%S` to get the current date and time. - File content must contain only the raw prompt text from the user. - Do not add headings, bullets, annotations, or any markup. - Do not store assistant responses or metadata inside these files. diff --git a/CHANGES.md b/CHANGES.md index 65d53ce..7637ee5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,12 @@ +## v0.0.11 + +- fix: `.github/assistant-guidelines.md` names the right `date` command. + It left out the `T`, so a model following it wrote prompt files that do + not match the documented `YYYY-MM-DDTHH-MM-SS` name. + ## v0.0.10 - fix: the recorded model is now the model that actually answered. Every diff --git a/ai_prompt_auto_commit/data/assistant-guidelines.md b/ai_prompt_auto_commit/data/assistant-guidelines.md index a8fd9ff..3cb7067 100644 --- a/ai_prompt_auto_commit/data/assistant-guidelines.md +++ b/ai_prompt_auto_commit/data/assistant-guidelines.md @@ -19,7 +19,7 @@ These guidelines tell the assistant exactly how to write prompt files in this re - `HH-MM-SS` is the current time. - `raptor-mini-preview` is the model name. Replace this model name with the actual AI model that you use. - - Use `date +%Y-%m-%d%H-%M-%S` to get the current date and time. + - Use `date +%Y-%m-%dT%H-%M-%S` to get the current date and time. - File content must contain only the raw prompt text from the user. - Do not add headings, bullets, annotations, or any markup. - Do not store assistant responses or metadata inside these files. diff --git a/tests/test_prepare_repository.py b/tests/test_prepare_repository.py index 1f53592..295cd5f 100644 --- a/tests/test_prepare_repository.py +++ b/tests/test_prepare_repository.py @@ -5,8 +5,12 @@ import importlib.metadata import json import os +import re +from datetime import datetime from pathlib import Path +import pytest + from ai_prompt_auto_commit.common import PROMPTS_DIRECTORY from ai_prompt_auto_commit.prepare_repository import ( HOOK_SCRIPT_FILENAME, @@ -100,6 +104,30 @@ def test_get_default_assistant_guidelines_only_one_header() -> None: next_header = content.find("---", header_end + 3) assert next_header == -1, "Multiple headers found in assistant guidelines" + +@pytest.mark.parametrize( + "guidelines", + [ + # ./release copies the .github file over the bundled one + Path(__file__).parent.parent / ".github" / "assistant-guidelines.md", + "bundled", + ], +) +def test_assistant_guidelines_date_command_matches_filename_pattern( + guidelines: Path | str, +) -> None: + """The guidelines tell other AI models which `date` command produces the + timestamp; it has to be the format the hooks write, `T` included.""" + if guidelines == "bundled": + content = get_default_assistant_guidelines() + else: + content = guidelines.read_text(encoding="utf-8") + match = re.search(r"`date \+([^`]+)`", content) + assert match, "the guidelines name no date command" + timestamp = datetime(2026, 10, 7, 9, 5, 3).strftime(match.group(1)) + assert timestamp == "2026-10-07T09-05-03" + + # --------------------------------------------------------------------------- # .claude/settings.json # --------------------------------------------------------------------------- From ead9ab10dc3ef2380c6b6834d7a45721c6c56378 Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Wed, 7 Oct 2026 09:40:51 +0200 Subject: [PATCH 2/2] docs: stage only the config in the update recipe `git add .` after `pre-commit autoupdate` stages every unrelated change and untracked file in the tree. All pre-commit needs is the updated .pre-commit-config.yaml, which it refuses to run with unstaged; say that, and stage just that file. Prompt: [fix review findings] Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dc7701e..50515af 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,13 @@ To update the hooks: ```shell pre-commit autoupdate -git add . +git add .pre-commit-config.yaml pre-commit run --hook-stage manual prepare-ai-repository ``` +pre-commit refuses to run while `.pre-commit-config.yaml` has unstaged +changes, hence the `git add` between the two. + ## Contributing prompt recording for another AI `.github/assistant-guidelines.md` tells AI models how to record each of your prompts.