ai-code-interface.el
Copilot instructions290 starsChanged 56 days agoApache-2.0View on GitHub
This is ai-code-interface.el, an Emacs package that provides a uniform interface for AI-assisted software development across pluggable AI coding backends. The package uses a pluggable backend system: - Backends are registered in ai-code-backends.el - Each backend provides functions for: start, resume, switch-to-buffer, send-command - Backend selection is dynamic via ai-code-set-backend - Supported backends are registered in ai-code-backends.el, which is the source of truth for the current backend list.
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
24 rules. About 0 are common, 9 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Use lexical-binding: t in all files
- Distinctive: line 23
Follow standard Emacs Lisp naming conventions:
- Very specific: line 33
Use declare-function for forward declarations
- Very specific: line 34
Prefer defcustom for user-configurable variables
- Very specific: line 35
Use ;;;###autoload cookies for interactive commands
- Very specific: line 39
Use require statements at the beginning of files
- Very specific: line 46
Test files are named with test_ prefix
- Very specific: line 47
Run tests with: emacs -batch -l ert -l <test-file>.el -f ert-run-tests-batch-and-exit
- Very specific: line 50
Use ert-deftest for defining tests
- Very specific: line 51
Test names should be descriptive: test-module--function-name-scenario
- Very specific: line 52
Use with-temp-buffer for testing buffer-related functionality
- Distinctive: line 56
Treat new byte-compilation warnings as regressions when touching Emacs Lisp code.
- Very specific: line 99
Add backend definition to ai-code-backends.el
- Very specific: line 100
Create backend-specific file if needed (e.g., ai-code-github-copilot-cli.el)
- Distinctive: line 101
Update README.org with new backend information
- Very specific: line 104
Place in appropriate module (ai-code-change.el, ai-code-agile.el, etc.)
- Very specific: line 105
Add interactive commands with ;;;###autoload
- Very specific: line 106
Update transient menu in ai-code.el if needed
- Distinctive: line 107
Add tests to corresponding test file
- Distinctive: line 110
Write a failing test first (TDD approach)
- Distinctive: line 112
Ensure existing tests still pass
- Distinctive: line 113
Update documentation if behavior changes
- Distinctive: line 137
Update README.org when adding features, backends, or changing workflows
- Distinctive: line 139
Use Org-mode formatting for links, code blocks, and sections
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Copilot Instructions for ai-code-interface.el
Project Overview
This is ai-code-interface.el, an Emacs package that provides a uniform interface for AI-assisted software development across pluggable AI coding backends.
Language and Technology
- Language: Emacs Lisp
- Package System: Emacs package with
use-packagesupport - Version Control: Git with Magit integration
- Testing Framework: ERT (Emacs Lisp Regression Testing)
Code Style and Conventions
File Naming
- Main module:
ai-code.el - Sub-modules:
ai-code-*.el(e.g.,ai-code-backends.el,ai-code-agile.el) - Tests:
test_*.el(e.g.,test_ai-code-change.el)
Emacs Lisp Conventions
- Use
lexical-binding: tin all files - Follow standard Emacs Lisp naming conventions:
- Public functions:
ai-code-function-name - Private functions:
ai-code--function-name(double dash prefix) - Custom variables:
ai-code-variable-name
- Public functions:
- Include proper header comments with:
- Author
- Version (when applicable)
- Package-Requires
- SPDX-License-Identifier: Apache-2.0
- Commentary section
- Use
declare-functionfor forward declarations - Prefer
defcustomfor user-configurable variables - Use
;;;###autoloadcookies for interactive commands
Code Organization
- Group related functionality in separate modules
- Use
requirestatements at the beginning of files - Maintain clear separation between backend implementations and interface code
Testing
Running Tests
- Tests use ERT (Emacs Lisp Regression Testing)
- Test files are named with
test_prefix - Run tests with:
emacs -batch -l ert -l <test-file>.el -f ert-run-tests-batch-and-exit
Test Conventions
- Use
ert-deftestfor defining tests - Test names should be descriptive:
test-module--function-name-scenario - Use
with-temp-bufferfor testing buffer-related functionality - Mock external dependencies with
cl-letfwhen needed
Byte-compilation warnings
- Treat new byte-compilation warnings as regressions when touching Emacs Lisp code.
- For documentation hygiene on touched files, also run
M-x checkdoc(or batchcheckdoc-file) before wrapping up changes.
Dependencies
Required
- Emacs 26.1 or later
org(Org-mode support)magit(Git integration)transient(Menu system)- One of the backend packages (e.g.,
claude-code.el)
Optional
helm(Enhanced auto-completion)yasnippet(Snippet support)gptel(AI-generated headlines)flycheck(Error fixing features)projectile(Project management)helm-gtags(Tag navigation)
Backend Architecture
The package uses a pluggable backend system:
- Backends are registered in
ai-code-backends.el - Each backend provides functions for: start, resume, switch-to-buffer, send-command
- Backend selection is dynamic via
ai-code-set-backend - Supported backends are registered in
ai-code-backends.el, which is the source of truth for the current backend list.
Key Features to Preserve
- Interactive AI Chat: Dedicated Emacs buffer for AI sessions
- Context-Aware Prompting: Automatic inclusion of file paths, regions, and function context
- Code Manipulation: Change code, implement TODOs, explain code, fix errors
- Agile Development: TDD cycle support, refactoring assistance
- Git Integration: Diff review, git blame/log analysis, Magit transient menus
- Prompt Management:
.ai.code.prompt.orgfile for reusable prompts - Transient Menu: Main menu via
C-c a
Common Tasks
Adding a New Backend
- Reference PR #2 for GitHub Copilot CLI integration as an example
- Add backend definition to
ai-code-backends.el - Create backend-specific file if needed (e.g.,
ai-code-github-copilot-cli.el) - Update README.org with new backend information
Adding New Features
- Place in appropriate module (
ai-code-change.el,ai-code-agile.el, etc.) - Add interactive commands with
;;;###autoload - Update transient menu in
ai-code.elif needed - Add tests to corresponding test file
Fixing Bugs
- Write a failing test first (TDD approach)
- Fix the issue with minimal changes
- Ensure existing tests still pass
- Update documentation if behavior changes
Files to Avoid Modifying
.gitignore: Contains project-specific ignore patternsLICENSE: Apache-2.0 license fileHISTORY.org: Historical changelog- Generated files:
GTAGS,GRTAGS,GPATH,.projectile
Build and Verification
Byte Compilation
emacs -batch -f batch-byte-compile *.elRunning All Tests
emacs -batch -l ert -l test_ai-code-change.el -l test_ai-code-prompt-mode.el -f ert-run-tests-batch-and-exitDocumentation
- Main documentation:
README.org(Org-mode format) - Update README.org when adding features, backends, or changing workflows
- Include code examples in Emacs Lisp format
- Use Org-mode formatting for links, code blocks, and sections
Special Considerations
- This package integrates with multiple external AI CLI tools
- Changes should maintain compatibility across different backends
- The user interface should remain consistent regardless of backend
- Transient menus are central to the UX - preserve the menu structure
- The package emphasizes agile development workflows - maintain TDD and refactoring features
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

