You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/configuration/prompt-library.md
+93-2Lines changed: 93 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,8 @@ Markdown prompts consist of two main parts:
147
147
-`## system` - System messages that set the LLM's behaviour
148
148
-`## user` - User messages containing your requests
149
149
150
+
In the markdown prompt, above, [placeholders](/configuration/prompt-library#with-placeholders) are used to inject dynamic content from a visual selection.
151
+
150
152
### Options
151
153
152
154
Both markdown and Lua prompts support a wide range of options to customise behaviour:
@@ -241,11 +243,10 @@ opts = {
241
243
-`modes` - Only show in specific modes (`{ "v" }` for visual mode)
242
244
-`placement` - For inline interaction: `new`, `replace`, `add`, `before`, `chat`
243
245
-`pre_hook` - Function to run before the prompt is executed (Lua only)
244
-
-`rules` - Specify a rule group to load with the prompt
-`user_prompt` - Get user input before actioning the response
247
248
248
-
### Placeholders
249
+
### With Placeholders
249
250
250
251
Placeholders allow you to inject dynamic content into your prompts. In markdown prompts, use `${placeholder.name}` syntax:
251
252
@@ -515,6 +516,36 @@ I'll think of something clever to put here...
515
516
516
517
Context items appear at the top of the chat buffer. URLs are automatically cached for you.
517
518
519
+
#### MCP Servers
520
+
521
+
You can also specify [MCP servers](/configuration/mcp) to be loaded with your prompt:
522
+
523
+
::: code-group
524
+
525
+
````markdown [Markdown]
526
+
---
527
+
name: Prompt with MCP servers
528
+
interaction: chat
529
+
description: A prompt that starts MCP servers
530
+
mcp_servers:
531
+
- tavily-mcp
532
+
- filesystem
533
+
---
534
+
````
535
+
536
+
````lua [Lua]
537
+
["Prompt with MCP servers"] = {
538
+
interaction="chat",
539
+
description="A prompt that starts MCP servers",
540
+
mcp_servers= {
541
+
"tavily-mcp",
542
+
"filesystem",
543
+
},
544
+
},
545
+
````
546
+
547
+
:::
548
+
518
549
#### Pickers
519
550
520
551
Pickers allow you to create dynamic prompt menus based on runtime data.
@@ -583,6 +614,66 @@ Pre-hooks allow you to run custom logic before a prompt is executed. This is par
583
614
584
615
For the inline interaction, the plugin will detect a number being returned from the `pre_hook` and assume that is the buffer number you wish any code to be streamed into.
585
616
617
+
#### Rules
618
+
619
+
You can also specify rules to be loaded with your prompt:
620
+
621
+
::: code-group
622
+
623
+
````markdown [Markdown]
624
+
---
625
+
name: Prompt with rules
626
+
interaction: chat
627
+
description: A prompt that loads rules
628
+
rules:
629
+
- default
630
+
- my_other_rule
631
+
---
632
+
````
633
+
634
+
````lua [Lua]
635
+
["Prompt with rules"] = {
636
+
interaction="chat",
637
+
description="A prompt that loads rules",
638
+
rules= {
639
+
"default",
640
+
"my_other_rules",
641
+
},
642
+
},
643
+
````
644
+
645
+
:::
646
+
647
+
#### Tools
648
+
649
+
You can also specify tools to be loaded with your prompt. These can be individual tools as well as tool groups:
650
+
651
+
::: code-group
652
+
653
+
````markdown [Markdown]
654
+
---
655
+
name: Prompt with tools
656
+
interaction: chat
657
+
description: A prompt that loads tools
658
+
tools:
659
+
- cmd_runner
660
+
- insert_edit_into_file
661
+
---
662
+
````
663
+
664
+
````lua [Lua]
665
+
["Prompt with tools"] = {
666
+
interaction="chat",
667
+
description="A prompt that loads tools",
668
+
tools= {
669
+
"cmd_runner",
670
+
"insert_edit_into_file",
671
+
},
672
+
},
673
+
````
674
+
675
+
:::
676
+
586
677
#### Workflows
587
678
588
679
Workflows allow you to chain multiple prompts together in a sequence. That is, the first prompt is sent to the LLM, the LLM responds, then the next prompt in the workflow is sent, etc. This can be useful for implementing multi-step processes such as chain-of-thought reasoning or iterative code refinement.
Copy file name to clipboardExpand all lines: doc/upgrading.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,20 @@ CodeCompanion follows [semantic versioning](https://semver.org/) and to avoid br
18
18
- Diff keymaps have moved from `interactions.inline.keymaps` to `interactions.shared.keymaps` ([#2600](https://github.com/olimorris/codecompanion.nvim/pull/2600))
19
19
- All diff config has moved to `display.diff` ([#2600](https://github.com/olimorris/codecompanion.nvim/pull/2600))
20
20
21
+
### Prompt Library
22
+
23
+
- The location of rules within a prompt library item has changed from `opts.rules` to `rules`. They now also support workflows:
If your prompt library entries have an `alias` defined then you can invoke them using a slash command. In the cmd line `:CodeCompanion /<alias>` or `/<alias>` if you're in the chat buffer.
0 commit comments