Add architecture guardrails derivation command for existing repos#361
Conversation
Agent-Logs-Url: https://github.com/tninja/ai-code-interface.el/sessions/9370ff3b-9d42-4c80-b855-e61b0f2455a4 Co-authored-by: tninja <714625+tninja@users.noreply.github.com>
Agent-Logs-Url: https://github.com/tninja/ai-code-interface.el/sessions/9370ff3b-9d42-4c80-b855-e61b0f2455a4 Co-authored-by: tninja <714625+tninja@users.noreply.github.com>
| "Test `ai-code-derive-architecture-guardrails' does not overwrite an existing file." | ||
| (let* ((tmp-root (make-temp-file "ai-code-guardrails-existing" t)) | ||
| (files-dir (expand-file-name ".ai.code.files" tmp-root)) | ||
| (target-file (expand-file-name "architecture-guardrails.md" files-dir)) |
There was a problem hiding this comment.
@copilot I prefer to put to .ai.code.files/architecture/guardrails.org, it is a org-mode format file.
There was a problem hiding this comment.
Updated in 2dc0081. The guardrails file now lives at .ai.code.files/architecture/guardrails.org, uses an Org template, and the prompt/tests/README were adjusted to match.
Agent-Logs-Url: https://github.com/tninja/ai-code-interface.el/sessions/9322736a-d00b-4e20-b59e-c90c9286ebe7 Co-authored-by: tninja <714625+tninja@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Adds a repo-level command for deriving and maintaining concise architecture guardrails under .ai.code.files/, helping future AI coding sessions reuse project-specific boundaries and validation expectations.
Changes:
- Adds
ai-code-derive-architecture-guardrailsand helper functions/templates inai-code-discussion.el. - Exposes the command from the transient menu via
C-c a A. - Documents the workflow and adds focused ERT coverage for file creation, prompting, preservation, cancellation, and menu exposure.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
ai-code-discussion.el |
Adds guardrails file path/template helpers and the interactive derivation command. |
ai-code.el |
Adds the new command to the transient menu. |
README.org |
Documents the repo guardrails capture workflow. |
test/test_ai-code-discussion.el |
Adds tests for the new command behavior and menu entry. |
| ;;;###autoload | ||
| (defun ai-code-derive-architecture-guardrails () |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2dc0081fd6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (let ((git-root (ai-code--git-root))) | ||
| (unless git-root | ||
| (user-error "Not in a git repository")) | ||
| (ai-code--ensure-architecture-guardrails-file) |
There was a problem hiding this comment.
Delay guardrails file creation until prompt is confirmed
Calling ai-code--ensure-architecture-guardrails-file before reading user input causes a filesystem side effect even when the request is canceled (for example, aborting at the Prompt: minibuffer). In a repo that does not already have this file, ai-code-derive-architecture-guardrails will still create .ai.code.files/architecture/guardrails.org, leaving the worktree dirty despite no prompt being sent; this is unexpected for a canceled action and should be gated on successful prompt confirmation.
Useful? React with 👍 / 👎.
The test ai-code-test-eca-menu-group-appears-in-layout incorrectly asserted that key "A" maps to ai-code-eca-add-workspace-folder in both parent transient layouts. PR #361 added ("A" "Derive Architecture Guardrails" ai-code-derive-architecture-guardrails) to ai-code--menu-other-tools, creating a collision. Changes: - Add canonical check of all ECA bindings against ai-code-eca-menu - Remove "A" from parent-layout command assertions (known collision) - Add weak (should (transient-get-suffix prefix "A")) to document the collision without dictating what "A" maps to - Keep "F" special-case handling unchanged Agent-Logs-Url: https://github.com/tninja/ai-code-interface.el/sessions/1882eb4f-2064-491d-9972-b79610269ee4 Co-authored-by: tninja <714625+tninja@users.noreply.github.com>
) * Initial plan * fix: update ECA layout test to not assume parent-menu key ownership The test ai-code-test-eca-menu-group-appears-in-layout incorrectly asserted that key "A" maps to ai-code-eca-add-workspace-folder in both parent transient layouts. PR #361 added ("A" "Derive Architecture Guardrails" ai-code-derive-architecture-guardrails) to ai-code--menu-other-tools, creating a collision. Changes: - Add canonical check of all ECA bindings against ai-code-eca-menu - Remove "A" from parent-layout command assertions (known collision) - Add weak (should (transient-get-suffix prefix "A")) to document the collision without dictating what "A" maps to - Keep "F" special-case handling unchanged Agent-Logs-Url: https://github.com/tninja/ai-code-interface.el/sessions/1882eb4f-2064-491d-9972-b79610269ee4 Co-authored-by: tninja <714625+tninja@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tninja <714625+tninja@users.noreply.github.com>
This adds a lightweight repo-level command to derive architecture guardrails from the current codebase and store them under
.ai.code.files/. The goal is to give future AI coding sessions a compact, practical map of module boundaries, dependency rules, ownership, and required validation without imposing a heavier architecture framework.New command
ai-code-derive-architecture-guardrailsas an interactive command inai-code-discussion.el.ai.code.files/architecture/guardrails.orgif it does not already existPrompt behavior
Menu integration
A→Derive Architecture GuardrailsFile bootstrap behavior
Behavioral coverage
Example prompt shape:
> [!WARNING]
>
>