Skip to content

Simple preset manager for AI Coding Agents. Package rule and prompt configurations, then deploy to multiple projects.

License

Notifications You must be signed in to change notification settings

sushichan044/ajisai

Repository files navigation

ajisai

ci Go Reference Ask DeepWiki

Ajisai is a simple preset manager for AI Coding Agents.

You can package rule and prompt configurations and reuse them across multiple projects.

Features

  • Interoperability 🤖 - Simply by writing rules and prompts in a single format, they are automatically deployed to the appropriate format and directory for each supported AI Coding Agent.
  • Reuse 📤 - You can import AI presets not only from local directories but also from remote Git repositories.
  • Gradual Introduction ⏩: Enables adoption without conflicting with existing rules.

Supported AI Coding Agents

  • GitHub Copilot in VSCode
    • Update VSCode to 1.100 or later
    • Use latest GitHub Copilot extension
    • Make sure you set chat.promptFiles to true in project or user settings.
    • mode and tools property in prompt file is not supported yet
    • Currently no support for using GitHub Copilot in other editors, IDEs.
  • Cursor
  • Windsurf
    • Update Windsurf to Wave 8 or later
  • Cline
  • Roo Code
  • Devin (Maybe partial support)

Installation

homebrew
brew install sushichan044/tap/ajisai
go install (requires Go 1.21+)
go install github.com/sushichan044/ajisai@latest

[!WARNING] Because ajisai embeds its revision information at build time, the revision isn't displayed correctly when installed using go install.

mise
# mise.toml
[tools]
"go:github.com/sushichan044/ajisai" = "latest"

[!WARNING] Because ajisai embeds its revision information at build time, the revision isn't displayed correctly when installed using go install.

manual

Download the latest release from the GitHub releases page.

Quick Start

ajisai is controlled via CLI.

The default configuration file is ajisai.yml or ajisai.yaml in the current directory, but a different file can be specified using the --config (or -c) flag.

1. Write Config

workspace:
  imports:
    local_rules:
      type: local
      path: "./.ai"
      include:
      - default # See Special `default` preset docs for details
  integrations:
    cursor:
      enabled: true
    github-copilot:
      enabled: true
    windsurf:
      enabled: true

2. Write your rules

Write your rules under .ai/rules/**/*.md.

Refer Rule file - File Reference for supported syntax and structure.

3. Deploy your rules

Just run ajisai apply.

User Guide

In ajisai, instructions for AI Coding Agents are handled using the following units:

  • Preset: A collection of specific Rules and reusable prompts.
  • Package: A unit for exporting multiple presets.

When reusing packaged instructions, you specify the package to use and the presets to include from it.

Defining and Importing Local Preset Packages

You can define reusable preset packages locally, for example, within a dedicated directory in your project (like .ai/) or in a separate local directory. This same package definition approach is fundamental, whether you intend to use the package only locally or later share it via Git.

1. Define Your Package's Exports

Create an ajisai.yml or ajisai.yaml file in the root directory of your intended package (e.g., <project root>/.ai/ajisai.yaml). In this file, you define what presets your package will export using the package.exports field. Each key under exports becomes a named preset that can be imported.

# Example: <project root>/.ai/ajisai.yaml defining a package with an 'essential' preset
package:
  exports:
    # 'essential' is the name of the preset being exported from this package.
    # Users will refer to this name when importing.
    essential:
      description: "Essential coding standards and prompts for the project." # Optional
      rules:
        # List of glob patterns for rule files relative to this ajisai.yaml
        - README.md # You can include markdown files directly as rules
        - essential/rules/**/*.md
      prompts:
        # List of glob patterns for prompt files relative to this ajisai.yaml
        - essential/prompts/**/*.md
    # You can define and export multiple presets from a single package file:
    # project-specific-utils:
    #   rules:
    #     - utils/rules/**/*.md
    #   prompts:
    #     - utils/prompts/**/*.md

2. Structure Your Rule and Prompt Files

Organize your actual rule and prompt files according to the paths (glob patterns) you specified in the package.exports section. These paths are relative to the location of this package ajisai.yaml file.

For the essential preset example above, the directory structure within .ai/ might look like this:

<project root>
└── .ai/
    ├── essential/
    │   ├── rules/
    │   │   ├── common-guidelines.md
    │   │   └── go-specific.md      # Included by essential/rules/**/*.md
    │   └── prompts/
    │       └── refactor-prompt.md  # Included by essential/prompts/**/*.md
    ├── README.md                   # Directly included as a rule
    └── ajisai.yaml                 # The package definition file itself

Any rule file created or matching the glob patterns (e.g., a new file in .ai/essential/rules/) will automatically become part of the essential preset. Refer to the File Reference for the specific format and frontmatter expected in rule and prompt files.

3. Import the Local Package into Your Workspace

To use this locally defined package in your main project (or any other project that can access this path), modify your primary ajisai.yml (usually at the project root) to import it using type: local.

# <project root>/ajisai.yaml (Main workspace configuration)
workspace:
  imports:
    # 'my_local_essentials' is an arbitrary name for this import instance in your workspace.
    my_local_essentials:
      type: local
      path: ./.ai  # Path to the directory containing the package's ajisai.yaml
      include:
        - essential # Specify the name of the preset(s) to import from that package.
  # ... other workspace configurations like integrations
  integrations:
    cursor:
      enabled: true
    # ...

This setup allows you to manage and version control your shared AI instructions within a subdirectory of your project or a dedicated local repository.

Sharing and Exporting Packages via Git

To share your presets as a package via Git, allowing others (or yourself in different projects) to reuse them:

  1. Create an ajisai.yml or ajisai.yaml at repository root.

  2. Define exported preset in config file and place your preset content in the same way as Defining and Importing Local Preset Packages section.

  3. Commit and push.

Your package is now ready to be imported by others using its Git repository URL.

Import Preset Packages via Git

For example, to import the essential preset from a package shared via Git (as defined in the "Sharing and Exporting Packages via Git" guide), add the following configuration to the ajisai.yml in the project root of the importing workspace:

Note

You need to have access to the repository where the package definitions are stored.

# ajisai.yml in your workspace
workspace:
  imports:
    org-essential: # you can specify any name to identify imported preset packages.
      type: git
      repository: your-preset-package-repository-url # URL of the Git repository
      include:
      - essential # deploy `essential` preset from that package.

  # In `integrations`, you specify the AI Coding Agent that will actually utilize the imported preset package.
  integrations:
    cursor:
      enabled: true
    github-copilot:
      enabled: true
    windsurf:
      enabled: true

Tip: Special default preset

If you do not have an ajisai.yml or ajisai.yaml file in your package root (e.g., a simple Git repository with just rules/prompts in a conventional structure), but your project adheres to a special directory structure as shown below, you can specify default in the include setting to have this structure recognized as a preset.

  • Write rules at <package root>/rules/**/*.md
  • Write prompts at <package root>/prompts/**/*.md

So you can import this to your workspace with:

workspace:
  imports:
    org-default:
      type: git
      repository: org-rules-repo-url # A repo with files in <root>/rules/ and/or <root>/prompts/
      include:
      - default # This 'default' refers to the special auto-detected preset
    local-default:
      type: local
      path: "./.ai"
      include:
      - default

File Reference

Rule File (*.md)

Each rule Markdown file can have the following metadata in its frontmatter:

Key Type Required Description
attach String Yes Situation you want AI to read this rule.
Choose from always, glob, agent-requested, manual.
globs Array Yes
(when attach is glob)
An array of glob patterns specifying which files this rule should apply to.
(e.g., ["**/*.go", "!**/*_test.go"]).
description String Yes
(when attach is agent-requested)
A brief description of what the prompt is for.

Example rules/my-custom-rule.md:

---
attach: always
globs:
  - "**/*.go"
  - "!**/*_test.go"
---

This is the main content of the rule.
It describes the coding standard in detail...

Prompt File (*.md)

Key Type Required Description
description String No A brief description of what the prompt is for.

Example prompts/my-refactor-prompt.md:

---
description: A prompt to help refactor Go code for better readability.
---

Please refactor the following Go code to improve its readability and maintainability, keeping in mind our company's Go coding standards.

Config Reference

# This file (`ajisai.yml` or `ajisai.yaml`) can define EITHER a package OR a workspace, but not both.

# To define a re-usable package (typically placed at the root of a package repository or a dedicated local directory):
package:
  name: "sushichan044/example" # Optional: Package name. Currently has no major effect but can be used for identification.
  exports: # Define presets exported by this package.
    essential: # This is the preset name, e.g., 'essential'.
      description: "Core set of rules and prompts." # Optional
      rules: # Glob patterns for rule files, relative to this ajisai.yml
      - README.md
      - essential/rules/**/*.md
      prompts: # Glob patterns for prompt files, relative to this ajisai.yml
      - essential/prompts/**/*.md
    # another-preset:
    #   ...

# To define a workspace configuration (typically placed at your project root):
workspace:
  # Defines the preset packages to be used in this workspace.
  imports:
    local_rules: # Arbitrary identifier for this import source
      type: local
      path: "./.ai" # Path to the directory containing the package's ajisai.yml
      include: # List of preset names to import from that package
      - default # e.g., 'default' if the local package exports a 'default' preset or uses the special default structure
    remote_rules:
      type: git
      repository: https://github.com/sushichan044/ai-presets.git
      include:
      - example1 # Name of a preset exported by the package in the Git repository
  # Defines which AI Coding Agent integrations will utilize the imported presets.
  integrations:
    cursor:
      enabled: true # Set to true to deploy applicable presets for Cursor
    github-copilot:
      enabled: true
    windsurf:
      enabled: true

settings:
  # Specifies the directory where ajisai temporarily caches imported packages.
  cacheDir: "./.cache/ajisai" # default: ./.cache/ajisai

  # Sets the namespace that ajisai uses when deploying imports.
  # This helps avoid conflicts if multiple tools write to similar paths.
  # For example, if the namespace is `ajisai`, Cursor Rules are deployed to `.cursor/rules/ajisai/**/*.mdc`.
  namespace: ajisai # default: ajisai

  # Whether to enable experimental features.
  experimental: false # default: false

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues on the GitHub repository.

About

Simple preset manager for AI Coding Agents. Package rule and prompt configurations, then deploy to multiple projects.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 5

Languages