Prompt-and-Tag is a tool designed to enhance AI-assisted development by seamlessly integrating your codebase with Large Language Models (LLMs). It creates synchronized snapshots of your code, making it easier to maintain context in AI conversations.
Prompt-and-Tag is a Makefile that:
- 📸 Creates a snapshot of your codebase
- 🏷️ Generates a unique Git tag
- 🔄 Converts your code into an LLM-friendly format
- 🔗 Provides a label for use in AI chats
This process ensures that your AI conversations are always in sync with the correct version of your code.
- Python 3.9+
- Git
- Make
- code2prompt
-
Copy the Makefile into your project root.
-
Run:
make setup
This sets up a virtual environment and installs the necessary packages.
-
When you're ready to consult an AI, run:
make prompt-and-tag
-
Develop: Work on your project as usual.
-
Prepare for AI Consultation: Before starting a conversation with an LLM, run:
make prompt-and-tag
-
Use the Generated Label: Copy the provided label.
-
AI Interaction: Paste the label into your AI chat. This ensures the AI knows exactly which version of the code you're discussing.
-
Iterate: Continue this cycle of development, tagging, and AI consultation as needed.
make help
: Displays all available commandsmake setup
: Sets up your environmentmake prompt-and-tag
: Creates your code snapshot and tagmake clean
: Removes the virtual environment
- Ensure you have the correct Python version installed.
- Verify that you're in the correct directory when running commands.
- If issues persist, please open an issue in the repository.
If you're working with a large codebase, there are a ton of ways to work around this thanks to the robust code2prompt filters provided. You can build custom filters for code2prompt
to limit the scope of the code snapshot and codify it as a make
target.
For conversations about deployment, IaC, and infrastructure, I might only want to include the following files:
code2prompt --path . --filter "Dockerfile, *.yml, *.md, Makefile" --exclude "venv, node_modules, dist, build, tests"
I can then add this as a target in my Makefile
prompt-and-tag-deployment:
# ... existing code
code2prompt --path . --filter "Dockerfile, *.yml, *.md, Makefile" --exclude "venv, node_modules, dist, build, tests" > prompt-and-tag-deployment.txt
# ... the rest of the make target
We welcome contributions! If you've found a bug or have an idea for an improvement, please:
- Fork the repository
- Create a new branch for your feature
- Commit your changes
- Open a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This project utilizes code2prompt, a tool for converting code to LLM-friendly prompts. I use it all the time and am grateful for Raphael's contribution to the AI-assisted development community. Perhaps this tool can be extended to support the prompt and tag workflow. We shall see!
Prompt-and-Tag aims to enhance your development process by bridging the gap between your codebase and AI assistants. I hope it proves to be a valuable addition to your workflow! 💻✨