AGENTS.md instructions for /home/clive/PycharmProjects/Orac
Follow standard Python conventions unless otherwise specified.
Module structure:
A module docstring MUST appear at the very top of the file describing its purpose.
Immediately following the module docstring, include comment-based metadata headers:
Author: Clive Bostock
Date:
Description:
Command-line scripts:
Use argparse for command-line parameters.
Code quality:
Include Google-style docstrings for all new public modules, classes, and functions.
When modifying existing public code, add missing docstrings where it is reasonable to do so within the scope of the change.
Use type hints where appropriate.
Favour readable, production-usable code with sensible error handling.
General:
Prefer clarity over cleverness.
Avoid unnecessary complexity.
For any created programs / executable scripts include provenance.
If pre-existing code does not already have these, ask for confirmation before adding.
Template:
I’ll inspect the working tree first so the commit includes only the current intended changes and does not disturb unrelated files.
Assistant
There are tracked edits plus several new database and voice files. I’m going to review the file list at the name/status level so the commit message matches the actual change set.
Assistant
The change set appears to add configurable TTS voice catalogue support, related DB schema objects, documentation updates, and removes two binary artifacts. I’ll run the focused tests that match the new files before staging.
Assistant
The focused pytest set passed. The guardrail structure check failed on an existing-looking stray file, docs/agent-guardrails/Untitled Document; I’ll check whether it is tracked before deciding whether to include it in this commit.
Assistant
tests/test_check_guardrails.py passes, and the failing guardrail file is not tracked or reported by git status. I’m staging the visible working tree changes now, including deletions and new files.
Assistant
The staged diff is cohesive around TTS voice catalogue support plus related docs/tests, with two obsolete binary artifacts removed. I’m committing it with a concise message.
Assistant
Committed changes on develop.
Commit: 6fa26a7 Add TTS voice catalog support
Verification:
poetry run pytest tests/test_tts_voice_catalog.py tests/test_plugin_audit_schema.py passed: 17 tests
poetry run pytest tests/test_check_guardrails.py passed: 8 tests
poetry run python scripts/check_guardrails.py failed because of an untracked/ignored stray file: docs/agent-guardrails/Untitled Document
Hey, Orac: What is today's date? A: I am Orac, an extensible artificial intelligence system, created by Clive Bostock.
The current time is 00:50. Today's date is Tuesday, 26 May 2026.
Assistant
Today’s date is Tuesday, 26 May 2026.
User
So I ask for the date, why is Orac starting with who Orac is abd who created Orac?
Assistant
I’ll trace where Orac’s identity/persona text is injected into prompts and how simple factual questions are routed, so the answer is grounded in the repo rather than guesswork.
Assistant
The relevant hit is the system-prompt policy, not the TTS/date path. I’m narrowing in on prompt assembly and the time-context injection now.
Assistant
Because the prompt currently puts Orac’s identity rule very prominently into every LLM turn, even for simple date/time questions.
The relevant pieces are:
src/controller/orac.py builds the system primer and always includes: Your name is Orac. For ordinary identity questions, answer simply: "I am Orac..."
src/controller/orac.py separately injects the current local time/date context.
Your input was phrased as Hey, Orac: What is today's date?, so the model saw both the name Orac and the always-present identity instruction, then over-applied it before answering the actual date.
So this is not because the date logic needs Orac’s biography. It is an LLM prompt-priority leak: the identity instruction is too easy for the model to apply when the user merely addresses Orac by name.
The fix is probably to tighten the system prompt rule to something like: “Only give the identity statement when the user explicitly asks who/what Orac is, who created it, or similar. Do not include identity information when the user merely addresses Orac by name.” For date/time specifically, add “answer directly with only the requested date/time unless the user asks for more.”
User
No, Hey Orac is the wake word/phrase. The recieved text is "Wjat is today's date?"
Assistant
I’ll check the actual request construction path from wake-word voice input into orac.prompt, because if the received text excludes “Hey Orac”, then the issue is prompt policy or history contamination rather than address parsing.
Assistant
That correction changes the diagnosis. The wake phrase is not being sent as user text; the problem is almost certainly that the model is seeing the identity sentence in its system primer or recent exchange and prepending it despite a date-only user message.
Assistant
You’re right. If the received text was only Wjat is today's date?, then my previous “Hey Orac caused it” explanation was wrong.
The likely cause is this: every prompt currently starts with the Orac system primer, and the first generated instruction includes the exact identity sentence:
src/controller/orac.py
text
Your name is Orac. For ordinary identity questions, answer simply: "I am Orac, ..."
Then the date/time context is added later. For a simple prompt like Wjat is today's date?, the model should ignore the identity rule, but it is apparently over-following the most salient sentence in the system primer and prepending it.
So the bug is not wake-word handling. It is prompt hygiene: the identity answer is embedded too strongly and too generally in every turn.
The fix is to change that primer text so it explicitly says identity must only be used for explicit identity/creator questions, and never for ordinary factual questions like date/time. Also worth adding a regression test for _build_contextual_prompt("Wjat is today's date?") asserting the prompt contains a date/time direct-answer instruction and a “do not include identity unless asked” instruction.
User
Please modify the primer text.
Assistant
I’ll update the generated primer text in src/controller/orac.py and add a focused regression test so date questions don’t invite the identity sentence. First I’m reading the required project guardrails for this Python/context prompt change.
Assistant
The change is small and stays inside the existing context-builder path. I’m going to adjust the identity wording where the primer is generated, then update the existing primer test and add a date-question regression around _build_contextual_prompt.
Assistant
I’m editing the primer at the single generation point, so the policy stays centralized instead of adding a special-case filter in the voice path.
Assistant
The primer now explicitly gates identity answers to direct identity/creator questions. I’m updating the tests to lock that behavior for both the primer text and date prompts.
Assistant
The test now uses your exact transcribed typo, so it guards the real failure mode rather than a cleaned-up example. I’m running the focused context-history tests next.
User
Should it not be in the resources/config/orac_system_prompt.yaml file that we implement this?
Assistant
Yes. That wording is policy content, so it belongs in resources/config/orac_system_prompt.yaml; the Python should render it, not own the sentence. I’ll move the configurable text there and leave code with a fallback/default renderer for compatibility.
Assistant
I found the current split: YAML owns most policy rules, but the identity answer wording was hardcoded in Python. I’m changing that to read an identity_answer_policy template from YAML, with Python only filling {assistant_name} and {identity_answer}.
Assistant
The test now proves the configured YAML owns that wording, and the renderer substitutes the identity placeholders. I’m rerunning the context tests.
Assistant
The focused prompt tests pass. I’m doing the lightweight guardrail checks now; the script may still report the pre-existing untracked Untitled Document issue we saw earlier.
Assistant
Yes. I moved the policy wording into resources/config/orac_system_prompt.yaml.
What changed:
Added identity.identity_answer_policy to the YAML prompt policy.
Updated src/controller/orac.py so it renders that YAML template, substituting {assistant_name} and {identity_answer}.
Kept a Python fallback for compatibility if the YAML key is missing.
Added regression coverage in tests/test_orac_context_history.py, including your typo case: Wjat is today's date?
Validation:
poetry run pytest tests/test_orac_context_history.py passed: 35 tests
poetry run pytest tests/test_check_guardrails.py passed: 9 tests
poetry run python scripts/check_guardrails.py passed
Working tree has the three expected modified files.