@@ -19,6 +19,12 @@ prompts can serve as starting points for common tasks, code generation, or proje
1919- [ Import] ( #import )
2020 - [ Import Capabilities] ( #import-capabilities )
2121 - [ Example Import Configuration] ( #example-import-configuration )
22+ - [ Tagging Prompts] ( #tagging-prompts )
23+ - [ Filtered Imports] ( #filtered-imports )
24+ - [ Filtering by IDs] ( #filtering-by-ids )
25+ - [ Filtering by Tags] ( #filtering-by-tags )
26+ - [ Combining Filter Types] ( #combining-filter-types )
27+ - [ Match Strategies] ( #match-strategies )
2228
2329## How Prompts Work
2430
@@ -328,4 +334,173 @@ import:
328334` ` `
329335
330336> **Note**: There is an example of shared prompts
331- > on [Gist](https://gist.github.com/butschster/1b7e597691cc1a6476b15dc120ecbddb) that can be used as a starting point.
337+ > on [Gist](https://gist.github.com/butschster/1b7e597691cc1a6476b15dc120ecbddb) that can be used as a starting point.
338+
339+ # # Prompt Tagging and Filtering
340+
341+ CTX allows you to organize prompts with tags and selectively import them based on these tags or their IDs. This helps
342+ manage large prompt collections and create specialized subsets of prompts for different contexts or use cases.
343+
344+ # ## Tagging Prompts
345+
346+ Tags are simple string labels that you can assign to prompts to categorize them :
347+
348+ ` ` ` yaml
349+ prompts:
350+ - id: python-helper
351+ description: "Helps with Python code and concepts"
352+ tags: [ "python", "coding", "development" ]
353+ messages:
354+ - role: user
355+ content: "You are a Python coding assistant. Help me write efficient Python code."
356+
357+ - id: creative-writing
358+ description: "Helps generate creative writing pieces"
359+ tags: [ "writing", "creative", "content-generation" ]
360+ messages:
361+ - role: user
362+ content: "You are a creative writing assistant. Help me generate compelling stories."
363+ ` ` `
364+
365+ Tags can be used to categorize prompts by :
366+
367+ - Domain (e.g., "writing", "coding", "data")
368+ - Skill level (e.g., "beginner", "advanced")
369+ - Purpose (e.g., "brainstorming", "debugging", "analysis")
370+ - Any other organizational scheme that fits your needs
371+
372+ # ## Filtered Imports
373+
374+ When importing prompts from external sources, you can selectively include only the prompts that match specific criteria
375+ using filters.
376+
377+ # ### Filtering by IDs
378+
379+ To import only specific prompts by their IDs :
380+
381+ ` ` ` yaml
382+ import:
383+ - url: "https://example.com/prompts-repository.yaml"
384+ filter:
385+ ids: [ "python-helper", "php-debug", "js-refactor" ]
386+ ` ` `
387+
388+ This will only import the three specified prompts and ignore all others from the source.
389+
390+ # ### Filtering by Tags
391+
392+ To import prompts based on their tags :
393+
394+ ` ` ` yaml
395+ import:
396+ - path: "./local-prompts.yaml"
397+ filter:
398+ tags:
399+ include: [ "coding", "debugging" ]
400+ exclude: [ "advanced" ]
401+ match: "any" # Can be "all" for AND logic
402+ ` ` `
403+
404+ This filter will :
405+
406+ - Include prompts that have either the "coding" OR "debugging" tag (because `match : " any" ` )
407+ - Exclude prompts that have the "advanced" tag, regardless of other tags
408+
409+ The ` match` parameter determines how the `include` tags are evaluated:
410+
411+ - `any` : Include if the prompt has ANY of the specified tags (OR logic)
412+ - `all` : Include only if the prompt has ALL of the specified tags (AND logic)
413+
414+ # ### Combining Filter Types
415+
416+ You can combine ID and tag filtering in a single import :
417+
418+ ` ` ` yaml
419+ import:
420+ - path: "./prompt-collection.yaml"
421+ filter:
422+ ids:
423+ - creative-writing
424+ - summarization-prompt
425+ tags:
426+ include:
427+ - content
428+ exclude:
429+ - technical
430+ match: "any" # This applies to the overall filter strategy
431+ ` ` `
432+
433+ With combined filtering :
434+
435+ - The `match` parameter at the root level determines how different filter types (IDs and tags) are combined
436+ - `match : " any" ` means prompts matching EITHER the ID criteria OR the tag criteria will be imported
437+ - ` match: "all"` would require prompts to match BOTH the ID criteria AND the tag criteria
438+
439+ # ### Match Strategies
440+
441+ Both tag filtering and combined filtering support two match strategies :
442+
443+ 1. **ANY** strategy (`match : " any" ` , default):
444+ - For tags: Include if the prompt has any of the specified include tags
445+ - For combined filters: Include if the prompt matches either the ID criteria or the tag criteria
446+
447+ 2. **ALL** strategy (` match: "all"`):
448+ - For tags : Include only if the prompt has all of the specified include tags
449+ - For combined filters : Include only if the prompt matches both the ID criteria and the tag criteria
450+
451+ # ## Use Cases
452+
453+ # ### Creating Domain-Specific Collections
454+
455+ Import only prompts related to a specific domain :
456+
457+ ` ` ` yaml
458+ import:
459+ - url: "https://example.com/all-prompts.yaml"
460+ filter:
461+ tags:
462+ include: [ "writing", "content-generation" ]
463+ ` ` `
464+
465+ # ### Excluding Advanced Prompts
466+
467+ Import all coding prompts except advanced ones :
468+
469+ ` ` ` yaml
470+ import:
471+ - url: "https://example.com/coding-prompts.yaml"
472+ filter:
473+ tags:
474+ include: [ "coding" ]
475+ exclude: [ "advanced" ]
476+ ` ` `
477+
478+ # ### Creating Curated Collections
479+
480+ Import a carefully selected set of prompts by their IDs :
481+
482+ ` ` ` yaml
483+ import:
484+ - url: "https://example.com/prompt-repository.yaml"
485+ filter:
486+ ids:
487+ - python-helper
488+ - summarization-prompt
489+ - brainstorming
490+ ` ` `
491+
492+ # ### Combining Tag-Based and ID-Based Filtering
493+
494+ Import prompts that are either in a specific category OR are specifically chosen :
495+
496+ ` ` ` yaml
497+ import:
498+ - url: "https://example.com/prompts.yaml"
499+ filter:
500+ ids:
501+ - special-prompt-1
502+ - special-prompt-2
503+ tags:
504+ include: [ "recommended" ]
505+ match: "any" # Import if either the ID matches OR it has the "recommended" tag
506+ ` ` `
0 commit comments