|
1 | | -# AI Persona Builder CLI |
| 1 | +# Copilot Instructions CLI |
2 | 2 |
|
3 | | -A command-line interface (CLI) for building and managing AI persona instructions from modular files. |
| 3 | +[](https://www.npmjs.com/package/instructions-composer-cli) |
| 4 | +[](https://www.gnu.org/licenses/gpl-3.0) |
| 5 | +[](https://nodejs.org/en/) |
4 | 6 |
|
5 | | -## Installation |
| 7 | +The Copilot Instructions CLI is a powerful command-line interface (CLI) designed to revolutionize how developers create and manage instructions for AI assistants. It shifts from monolithic, hard-to-maintain prompt files to a modular, reusable, and powerful ecosystem. |
6 | 8 |
|
7 | | -```bash |
8 | | -npm install -g copilot-instructions |
9 | | -``` |
| 9 | +## Table of Contents |
10 | 10 |
|
11 | | -## Usage |
| 11 | +- [Copilot Instructions CLI](#copilot-instructions-cli) |
| 12 | + - [Table of Contents](#table-of-contents) |
| 13 | + - [🚀 Introduction \& Philosophy](#-introduction--philosophy) |
| 14 | + - [What Problem Does It Solve?](#what-problem-does-it-solve) |
| 15 | + - [How Does It Solve This?](#how-does-it-solve-this) |
| 16 | + - [Who Would Use It?](#who-would-use-it) |
| 17 | + - [Why Would They Use It?](#why-would-they-use-it) |
| 18 | + - [Core Concepts](#core-concepts) |
| 19 | + - [Modules](#modules) |
| 20 | + - [Personas](#personas) |
| 21 | + - [Features](#features) |
| 22 | + - [Project Structure](#project-structure) |
| 23 | + - [Prerequisites](#prerequisites) |
| 24 | + - [Installation](#installation) |
| 25 | + - [CLI Commands](#cli-commands) |
| 26 | + - [Development](#development) |
| 27 | + - [Contributing](#contributing) |
| 28 | + - [License](#license) |
12 | 29 |
|
13 | | -### `build <personaFile>` |
| 30 | +## 🚀 Introduction & Philosophy |
14 | 31 |
|
15 | | -Builds a persona instruction file from a `.persona.jsonc` configuration. |
| 32 | +The Copilot Instructions CLI is a powerful command-line interface (CLI) designed to revolutionize how developers create and manage instructions for AI assistants. It shifts from monolithic, hard-to-maintain prompt files to a modular, reusable, and powerful ecosystem. |
16 | 33 |
|
17 | | -**Arguments:** |
| 34 | +Our core philosophy is that a persona is a **cognitive architecture** for an AI. By carefully layering modules, you define not just _what_ the AI should do, but _how it should think_. |
18 | 35 |
|
19 | | -- `personaFile`: (Required) The path to the `*.persona.jsonc` configuration file. |
| 36 | +- **Modular:** Build complex instruction sets from small, reusable parts. |
| 37 | +- **Version-Controlled:** Manage your prompts with the power of Git. |
| 38 | +- **Collaborative:** Share and reuse modules across projects and teams. |
| 39 | +- **Reliable:** Create deterministic, predictable AI behavior. |
| 40 | +- **Composable:** Combine modules to create sophisticated personas that can handle complex tasks. |
| 41 | +- **Extensible:** Add custom modules and personas to fit your specific needs. |
| 42 | +- **Declarative:** Use a simple, structured format to define your AI's capabilities. |
20 | 43 |
|
21 | | -**Example:** |
| 44 | +### What Problem Does It Solve? |
22 | 45 |
|
23 | | -```bash |
24 | | -copilot-instructions build ./personas/my-persona.jsonc |
25 | | -``` |
| 46 | +Modern AI is incredibly powerful, but instructing it is often a chaotic and frustrating process. Developers and teams who rely on AI assistants face a critical set of problems: |
26 | 47 |
|
27 | | -### `list` |
| 48 | +- **Inconsistency:** The same prompt can yield wildly different results, making the AI feel more like an unpredictable oracle than a reliable tool. |
| 49 | +- **Maintenance Nightmare:** Prompts quickly become monolithic, thousand-line text files that are brittle, impossible to debug, and terrifying to modify. |
| 50 | +- **Lack of Reusability:** Expert knowledge and effective instructions are trapped inside these giant prompts, leading to endless copy-pasting and duplicated effort. |
| 51 | +- **No Collaboration:** There is no effective way for a team to collaboratively build, manage, and version-control a shared set of AI instructions. |
28 | 52 |
|
29 | | -Lists all available instruction modules. |
| 53 | +In short, prompt engineering today feels more like an arcane art than a disciplined engineering practice. **The Copilot Instructions CLI solves this by treating AI instructions with the same rigor and structure as we treat source code.** |
30 | 54 |
|
31 | | -**Options:** |
| 55 | +### How Does It Solve This? |
32 | 56 |
|
33 | | -- `-t, --tier <name>`: Filter the list by a specific tier (e.g., `foundation`, `principle`, `technology`, `execution`). |
| 57 | +The Copilot Instructions CLI deconstructs the monolithic prompt into a modular, version-controlled ecosystem. It provides a complete methodology and a command-line interface (CLI) to build powerful, specialized AI agents called "Personas." |
34 | 58 |
|
35 | | -**Example:** |
| 59 | +This is achieved through a set of core architectural principles: |
36 | 60 |
|
37 | | -```bash |
38 | | -copilot-instructions list --tier=foundation |
39 | | -``` |
| 61 | +1. **Atomic Modules:** The system is built on **Modules**—small, single-purpose Markdown files that represent one atomic concept (e.g., a reasoning skill, a coding standard, a security principle). This makes instructions reusable, testable, and easy to maintain. |
| 62 | +2. **The 4-Tier System:** We enforce a strict **"waterfall of abstraction"** during compilation. Modules are organized into four tiers (`Foundation`, `Principle`, `Technology`, `Execution`), ensuring the AI's reasoning is built on a logical and predictable foundation, moving from universal truths down to specific actions. |
| 63 | +3. **Structured Schemas:** Every module adheres to a specific **Schema** (`procedure`, `specification`, `pattern`, etc.). This provides a machine-readable "API" for the AI's thought process, transforming vague requests into deterministic, structured instructions. |
| 64 | +4. **The Persona File:** A simple `persona.jsonc` file acts as a "recipe" or a `package.json` for your AI. It declaratively lists the modules to include, allowing you to compose, version, and share complex AI personalities with ease. |
40 | 65 |
|
41 | | -### `search <query>` |
| 66 | +By combining these elements, the system assembles a final, optimized prompt that is not just a list of instructions, but a complete **cognitive architecture** for the AI. |
42 | 67 |
|
43 | | -Searches for modules by name or description. |
| 68 | +### Who Would Use It? |
44 | 69 |
|
45 | | -**Arguments:** |
| 70 | +This system is designed for anyone who wants to move beyond simple AI conversations and build reliable, professional-grade AI agents. |
46 | 71 |
|
47 | | -- `query`: (Required) The text to search for. |
| 72 | +- **Software Development Teams:** To create a consistent "team copilot" that enforces shared coding standards, follows the team's architectural patterns, and writes code in a uniform style, regardless of which developer is prompting it. |
| 73 | +- **Senior Engineers & Architects:** To codify their expert knowledge and design principles into reusable modules, allowing them to scale their expertise across the entire organization. |
| 74 | +- **AI Power Users & Prompt Engineers:** To build and manage highly complex, multi-layered instruction sets that are simply not feasible with single-file prompts. |
| 75 | +- **AI Safety & Governance Teams:** To create "Auditor" personas with a provably consistent set of ethical rules and logical frameworks, enabling them to build AI agents that are aligned, predictable, and safe. |
48 | 76 |
|
49 | | -**Options:** |
| 77 | +### Why Would They Use It? |
50 | 78 |
|
51 | | -- `-t, --tier <name>`: Restrict the search to a specific tier. |
| 79 | +The ultimate goal of the Copilot Instructions CLI is to give you **control and reliability**. Instead of wrestling with an unpredictable AI, you can finally start engineering it. |
52 | 80 |
|
53 | | -**Example:** |
| 81 | +Users choose this system to: |
54 | 82 |
|
55 | | -````bash |
56 | | -copilot-instructions search "React" |
57 | | -``` |
| 83 | +- **Achieve Consistent, High-Quality Results:** Stop gambling on your AI's output. The structured, machine-centric approach dramatically reduces randomness and produces reliable, deterministic behavior. |
| 84 | +- **Build a Reusable Knowledge Base:** Stop writing the same instructions over and over. Create a module once and reuse it across dozens of personas and projects. |
| 85 | +- **Codify and Scale Expertise:** Capture the "secret sauce" of your best engineers in a library of modules that can elevate the entire team's performance. |
| 86 | +- **Collaborate Effectively:** Manage your AI's instruction set as a shared, version-controlled codebase. Use pull requests to propose changes and build a collective "AI brain" for your team. |
| 87 | +- **Maintain and Evolve with Ease:** When a standard changes, simply update a single module, and every persona that uses it is instantly updated. This is maintainability for the AI era. |
58 | 88 |
|
59 | | -### `create-module` |
| 89 | +The Copilot Instructions CLI is for those who believe that the power of AI should be harnessed with the discipline of engineering. |
60 | 90 |
|
61 | | -Creates a new instruction module. |
| 91 | +## Core Concepts |
62 | 92 |
|
63 | | -**Example:** |
| 93 | +> [!TIP] |
| 94 | +> To dive deeper into the project's vision, read the [**Core Concepts**](./docs/2-user-guide/01-core-concepts.md) documentation. |
64 | 95 |
|
65 | | -```bash |
66 | | -copilot-instructions create-module |
67 | | -``` |
| 96 | +### Modules |
68 | 97 |
|
69 | | -### `create-persona` |
| 98 | +Modules are the building blocks of your AI's knowledge and skills. They are individual Markdown files containing specific instructions, principles, or data. Each module is a self-contained unit of knowledge that can be mixed and matched to create different AI personas. |
70 | 99 |
|
71 | | -Creates a new persona configuration file. |
| 100 | +Modules are organized into a four-tier hierarchy: |
72 | 101 |
|
73 | | -**Example:** |
| 102 | +- **`foundation`**: The universal, abstract truths of logic, reason, ethics, and problem-solving. |
| 103 | +- **`principle`**: Established, technology-agnostic best practices and methodologies. |
| 104 | +- **`technology`**: Specific, factual knowledge about a named tool, language, or platform. |
| 105 | +- **`execution`**: Imperative, step-by-step playbooks for performing a specific, concrete action. |
| 106 | + |
| 107 | +> [!TIP] |
| 108 | +> Learn how to create your own modules in the [**Module Authoring Guide**](./docs/3-authoring/01-module-authoring-guide.md). |
| 109 | +
|
| 110 | +### Personas |
| 111 | + |
| 112 | +A persona is a collection of modules that define the behavior and capabilities of an AI assistant. Personas are defined in `.persona.jsonc` files, which specify the modules to include, the output file for the generated instructions, and other configuration options. |
| 113 | + |
| 114 | +> [!TIP] |
| 115 | +> Get started quickly by using pre-built [**Persona Templates**](./docs/1-getting-started/02-persona-templates.md). |
| 116 | +
|
| 117 | +## Features |
| 118 | + |
| 119 | +- **Modular Architecture**: Build complex AI personas by combining reusable instruction modules. |
| 120 | +- **Tiered Organization**: Modules are organized into a four-tier hierarchy for logical instruction composition. |
| 121 | +- **Easy Scaffolding**: Quickly create new modules and persona configurations with interactive CLI commands. |
| 122 | +- **Validation**: Ensure the integrity of your modules and personas with built-in validation. |
| 123 | +- **Customizable Output**: Configure the output path and attribution settings for your built persona files. |
| 124 | + |
| 125 | +## Project Structure |
74 | 126 |
|
75 | | -```bash |
76 | | -copilot-instructions create-persona |
| 127 | +``` |
| 128 | +. |
| 129 | +├── instructions-modules/ |
| 130 | +│ ├── foundation/ |
| 131 | +│ ├── principle/ |
| 132 | +│ ├── technology/ |
| 133 | +│ └── execution/ |
| 134 | +├── personas/ |
| 135 | +│ └── my-persona.persona.jsonc |
| 136 | +├── dist/ |
| 137 | +│ └── my-persona.md |
| 138 | +└── ... |
77 | 139 | ``` |
78 | 140 |
|
79 | | -### `validate [path]` |
| 141 | +- **`instructions-modules/`**: Contains the instruction modules, organized by tier. |
| 142 | +- **`personas/`**: Contains the persona configuration files. |
| 143 | +- **`dist/`**: The default output directory for built persona files. |
80 | 144 |
|
81 | | -Validates all modules and persona files, or a specific file or directory. |
| 145 | +> [!TIP] |
| 146 | +> For a detailed explanation of the codebase, see the [**Project Architecture**](./docs/4-contributing/02-project-architecture.md) document. |
82 | 147 |
|
83 | | -**Arguments:** |
| 148 | +## Prerequisites |
84 | 149 |
|
85 | | -* `path`: (Optional) The path to a specific file or directory to validate. |
| 150 | +- [Node.js](https://nodejs.org/) (version 22.17.1 or higher) |
| 151 | +- [npm](https://www.npmjs.com/) (Node Package Manager) |
86 | 152 |
|
87 | | -**Examples:** |
| 153 | +## Installation |
88 | 154 |
|
89 | 155 | ```bash |
90 | | -# Validate all modules and personas |
91 | | -copilot-instructions validate |
92 | | -
|
93 | | -# Validate a specific module |
94 | | -copilot-instructions validate ./instructions-modules/foundation/logic/if-then-statements.md |
95 | | -
|
96 | | -# Validate a specific persona |
97 | | -copilot-instructions validate ./personas/my-persona.jsonc |
98 | | -```` |
99 | | -
|
100 | | -## Persona File Format |
101 | | -
|
102 | | -A `*.persona.jsonc` file is a JSONC file that defines the composition of an AI persona. |
103 | | -
|
104 | | -**Schema:** |
105 | | -
|
106 | | -- `name` (string, required): A descriptive name for the persona. |
107 | | -- `description` (string, optional): A brief description of the persona. |
108 | | -- `output` (string, optional): The output path for the built persona file. Defaults to the persona file's name with an `.md` extension. |
109 | | -- `attributions` (boolean, optional): Whether to include attribution comments for each module. Defaults to `false`. |
110 | | -- `modules` (array of strings, required): An ordered list of module IDs to include. |
111 | | -
|
112 | | -**Example:** |
113 | | -
|
114 | | -```json |
115 | | -{ |
116 | | - "name": "React TDD Developer", |
117 | | - "description": "An AI assistant for developing React components using Test-Driven Development.", |
118 | | - "output": "dist/react-tdd-developer.md", |
119 | | - "attributions": true, |
120 | | - "modules": [ |
121 | | - "foundation/logic/first-principles-thinking", |
122 | | - "principle/methodology/test-driven-development", |
123 | | - "technology/framework/react/rules-of-hooks", |
124 | | - "execution/playbook/write-unit-tests" |
125 | | - ] |
126 | | -} |
| 156 | +npm install -g copilot-instructions-cli |
127 | 157 | ``` |
128 | 158 |
|
129 | | -## Module System |
| 159 | +> [!TIP] |
| 160 | +> For a more detailed installation guide, see the [**Quick Start Guide**](./docs/1-getting-started/01-quickstart.md). |
| 161 | +
|
| 162 | +## CLI Commands |
| 163 | + |
| 164 | +The CLI provides a set of commands for managing your modules and personas. |
| 165 | + |
| 166 | +- `build`: Builds a persona instruction file from a configuration. |
| 167 | +- `list`: Lists all available instruction modules. |
| 168 | +- `search`: Searches for modules by name or description. |
| 169 | +- `create-module`: Creates a new instruction module. |
| 170 | +- `create-persona`: Creates a new persona configuration file. |
| 171 | +- `validate`: Validates all modules and persona files. |
| 172 | + |
| 173 | +> [!TIP] |
| 174 | +> For a complete list of commands, options, and examples, see the [**CLI Reference**](./docs/2-user-guide/02-cli-reference.md). |
| 175 | +
|
| 176 | +## Development |
| 177 | + |
| 178 | +This project uses `npm` for package management. |
| 179 | + |
| 180 | +- `npm install`: Install dependencies. |
| 181 | +- `npm run build`: Build the project. |
| 182 | +- `npm run test`: Run tests. |
| 183 | +- `npm run lint`: Lint the codebase. |
| 184 | +- `npm run format`: Format the codebase. |
| 185 | + |
| 186 | +## Contributing |
130 | 187 |
|
131 | | -The module system is based on a four-tier hierarchy of directories within the `instructions-modules` directory. |
| 188 | +Contributions are welcome! Please read our [**Code of Conduct**](./docs/4-contributing/04-code-of-conduct.md) and follow the [**Governance**](./docs/4-contributing/01-governance.md) process to open an issue or submit a pull request. |
132 | 189 |
|
133 | | -- **Tier:** The top-level directory (e.g., `foundation`, `principle`, `technology`, `execution`). |
134 | | -- **Subject:** Subdirectories that further categorize the modules. |
135 | | -- **Module File:** A Markdown file with YAML frontmatter. |
| 190 | +> [!TIP] |
| 191 | +> Before contributing, please review our [**Testing Strategy**](./docs/4-contributing/03-testing-strategy.md). |
136 | 192 |
|
137 | | -**Module Frontmatter:** |
| 193 | +## License |
138 | 194 |
|
139 | | -- `name` (string, required): A human-readable name for the module. |
140 | | -- `description` (string, required): A brief description of the module. |
| 195 | +This project is licensed under the GNU General Public License v3.0. See the [LICENSE](LICENSE) file for details. |
0 commit comments