-
-
📌 Context & Problem Statement
When the AI agent (TOD) submits work, it frequently fails to format references to issues, pull requests, or builds correctly.
For example, TOD recently generated output like:
pr (path/to/project#123)Because TOD wrapped the reference in parentheses, downstream parsers misattribute or fail to render the link properly (e.g., misidentifying a pull request as an issue due to the extra syntax).
We need a stronger method within all relevant TOD skills under the
## Markdown entity referencessection to ensure AI models strictly adhere to the required syntax without adding extra brackets, parentheses, or unwanted punctuation.
🎯 Target Specification
The
## Markdown entity referencessection in all relevant TOD skills must explicitly define and enforce the following formatting rules:Write
<type> <reference>, where type isissue,pr(orpull request), orbuild. Use#123in the same project,path/to/project#123across projects, orPROJ-123when the project has a key.Examples:
issue #123,pr path/to/project#123, andbuild PROJ-123.
🚫 Explicit Anti-Patterns (To Add to Skill System Prompts)
Include a negative example table directly in skill prompts so TOD explicitly avoids these formatting errors:
❌ Invalid Output Reason ✅ Correct Output pr (path/to/project#123)Do not wrap reference in parentheses pr path/to/project#123issue [#123]Do not wrap reference in brackets issue #123build: PROJ-123Do not add colons after the entity type build PROJ-123pull request (PROJ-123)Do not wrap key in parentheses pull request PROJ-123
✅ Acceptance Criteria
- Section
## Markdown entity referencesin all relevant TOD skills is updated with the exact specification text and the 6 regex definitions. - Prompts explicitly instruct TOD to avoid wrapping references in parentheses
(), brackets[], or using colons:. - Test cases are added to verify TOD generates properly formatted references across issues, PRs, and builds.
- Written in a compact form so as to minimize AI token usage: The audience is AI, not human.
- Section
-
@robin @servicedesk please hold off while I validate the regex. There are some errors that I need to fix.
-
-
Implementation Specs
Here is a table built strictly from the single regex.
I've verified every example against the pattern, including lowercase
proj-123which should NOT match.Single regex (replaces all six):
^(?i:(?:issue|pr|pull request|build) )?(?:(?:[\w.-]+\/)*[\w.-]*#|\b[A-Z]+\b-)\d+$
Compliance
Entity Type Reference Style Valid Examples Matches the Regex? 1. Issue Path / Same Project issue #123issue path/to/project#123✅ Yes — Match 1 (0–10), Match 2 (11–36) 2. Issue Project Key issue PROJ-123✅ Yes (uppercase key) — Match 3 (37–51)
❌ No for lowercase keys (e.g.,proj-123)3. PR Path / Same Project pr #123pr path/to/project#123✅ Yes — Match 5 (70–77), Match 6 (78–100); also pull request #123— Match 7 (101–118)4. PR Project Key pr PROJ-123✅ Yes (uppercase key) — Match 9 (142–153); pull request PROJ-123— Match 10 (154–175)
❌ No for lowercase keys5. Build Path / Same Project build #123build path/to/project#123✅ Yes — Match 11 (176–186), Match 12 (187–212) 6. Build Project Key build PROJ-123✅ Yes (uppercase key) — Match 13 (213–227)
❌ No for lowercase keys
Example-by-example verification
# Example Corresponds to Match result 1 issue #123Entity Type 1 ✅ Match 1 (0–10) 2 issue path/to/project#123Entity Type 1 ✅ Match 2 (11–36) 3 issue PROJ-123Entity Type 2 ✅ Match 3 (37–51) 4 PROJ-123Entity Type 2 (bare, no prefix) ✅ Match 4 (52–60) 5 proj-123Entity Type 2 (lowercase key) ❌ No match 6 pr #123Entity Type 3 ✅ Match 5 (70–77) 7 pr path/to/project#123Entity Type 3 ✅ Match 6 (78–100) 8 pull request #123Entity Type 3 ✅ Match 7 (101–118) 9 pr path/to/project#123Entity Type 3 ✅ Match 8 (119–141) 10 pr PROJ-123Entity Type 4 ✅ Match 9 (142–153) 11 pull request PROJ-123Entity Type 4 ✅ Match 10 (154–175) 12 build #123Entity Type 5 ✅ Match 11 (176–186) 13 build path/to/project#123Entity Type 5 ✅ Match 12 (187–212) 14 build PROJ-123Entity Type 6 ✅ Match 13 (213–227)
Notes
- Lowercase project keys are intentionally rejected. The project-key branch
\b[A-Z]+\b-is case-sensitive; the(?i:…)case-insensitivity applies only to the entity prefix (issue|pr|pull request|build). Soproj-123fails whilePROJ-123passes — confirmed by match info (13 matches, no match for the lowercase line). - The prefix remains optional. Bare references like
PROJ-123are valid (Match 4); the table examples keep the prefixed forms to stay consistent with the original table. - Behavior change vs. the old six-pattern set: the old pattern matched only the
#style, soissue PROJ-123,pr PROJ-123, andbuild PROJ-123would not have matched it. The single regex now covers the project-key style for all three entity types.
Instructions
@servicedesk all of the above information is for your own context, and for documentation it would be great to document all of these examples within the TOD project. However, with regards to the actual changes that need to be made that AI agents will see, this should be minimal in order to minimize token usage.
- Lowercase project keys are intentionally rejected. The project-key branch
-
@zaakiy Thanks — noted the single regex and the direction to keep agent-facing skill text minimal while documenting the full examples in the TOD project.
@robin Blocked on implementation:
tod issue checkout --for-write 11returned HTTP 403 (no permission to write code in this project). Please take over from here. -
@servicedesk please note that if you ever write any regex into a comment in an issue or pull request related to this issue, ensure that the regex is in a code block and not a code span. Placing the regex into a code span will break the rendering in Markdown.
-
Noted — when posting regex related to this issue or related pull requests, I'll put the pattern in a fenced code block rather than an inline code span so Markdown rendering stays intact.
-
For example, TOD recently generated output like: pr (path/to/project#123)
@zaakiy What AI model are you using? The working on issue/PR and submit issue/PR skill already has instructions for reference format:
I used Grok 4.5 High and GPT 4.6 Sol Medium and they never take it wrong.
I am afraid putting exact regex patterns in the skill will not make the situation better since LLM generally prefers examples over formal syntaxes...
| Type |
Improvement
|
| Priority |
Normal
|
| Assignee | |
| Labels |
No labels
|
Summary
Follow-up from issue #10 (and issue #9). Strengthen Markdown entity reference guidance so agents stop emitting wrappers such as
pr (path/to/project#123), and add atodpre-post check for malformed references.Decisions (from issue #10)
using-tod.submit-issue-workandsubmit-pull-request-workkeep a short rule plus a pointer to that section.skills/(or similar), reviewed in the implementation PR.todpre-post check that warns or rejects malformed entity references in comments.## Markdown entity references:using-tod,submit-issue-work,submit-pull-request-work.Implementation
## Markdown entity referencesinusing-todwith compact valid patterns (case-insensitive), anti-patterns (no wrapping()/[], no:after type), and examples.submit-issue-workandsubmit-pull-request-workshort; point tousing-todfor the full rule set.skills/.todvalidation on comment-posting paths (warn or reject malformed typed references).Acceptance
using-toddocuments compact patterns and anti-patterns; submit skills stay short with a pointerskills/todwarns or rejects malformed Markdown entity references when posting comments