Init Operation
June 29, 2026 · View on GitHub
The init operation is the starting point for using Perpetual with your project. It sets up the necessary configuration and directory structure required for Perpetual to function properly within your project environment.
Usage
To initialize a new Perpetual configuration for your project, run the following command from the root directory of your project:
Perpetual init [flags]
The init operation supports several command-line flags to customize its behavior:
-l <language>: Select the programming language for setting up default LLM prompts. This flag is required and must be provided with a valid language option.-h: Display the help message, showing all available flags and their descriptions.-v: Enable debug logging. This flag increases the verbosity of the operation's output.-vv: Enable both debug and trace logging. This flag provides the highest level of verbosity.-ex: Create env-file examples inside the.perpetualdirectory. When used, this flag generates example.envconfiguration files for Perpetual and each supported LLM provider.
Example Usage
Perpetual init -l go
This command initializes Perpetual for a Go project, setting up the appropriate configuration files with Go-specific prompts and file-selection rules.
Supported Languages
Perpetual currently supports the following programming languages and technologies:
- Go (
go) - .NET (
dotnet) – Includes C#, VB.NET, XAML, Razor, CSS, JavaScript, and HTML files - Bash (
bash) – Intended mostly for Linux shell scripting - Python 3 (
python3) - Visual Basic 6 (
vb6) – Legacy VB6 projects - C (
c) - C++ (
cpp) - Arduino (
arduino) – Arduino sketches with C/C++ support - Flutter (
flutter) – Flutter/Dart apps, including selected native platform files
When using the -l flag, provide the language identifier as shown above. The language value is case-insensitive. You can add support for your programming language or project manually by editing file-selection regexps and LLM prompts in the corresponding config files.
Details
The init operation performs several tasks to set up your project for use with Perpetual:
- Creates a local Perpetual configuration directory. By default this is
.perpetualin the current directory. If the directory already exists, it is reused. - Creates a
.gitignorefile within the.perpetualdirectory to exclude generated Perpetual state files and local.envfiles from version control. - Creates a
description.md.templatefile that can be used as a starting point for creating a project description document. - Generates JSON configuration files for the selected programming language, including default prompts, regexps, tags, context-saving settings, incremental-mode settings, and file-selection rules.
- Creates example
.env.examplefiles for Perpetual and each supported LLM provider, but only when the-exflag is used:.env.example,ollama.env.example,openai.env.example,anthropic.env.example, andgeneric.env.example. - Warns about obsolete configuration files and directories if any are found in the
.perpetualdirectory.
When run inside an already initialized project, init will overwrite the generated project-local config files, .gitignore, and description template (and the example environment files when -ex is used). Back up any manual changes before running it again.
Note: The init operation respects the PERPETUAL_DIR environment variable. If set, it uses the specified directory instead of creating .perpetual in the current directory.
Directory and File Structure
After running the init operation, the following project-local structure is created by default:
<project_root>/
└── .perpetual/
├── .gitignore
├── description.md.template
├── op_annotate.json
├── op_implement.json
├── op_doc.json
├── op_explain.json
├── op_report.json
└── project.json
When the -ex flag is used, the following example environment files are additionally created inside the .perpetual directory:
<project_root>/
└── .perpetual/
├── .env.example
├── ollama.env.example
├── openai.env.example
├── anthropic.env.example
└── generic.env.example
In addition to project-local configuration, Perpetual can also read environment values from a global, OS-specific user config directory when loading settings, for example:
~/.config/Perpetual/
└── *.env
on Linux, or:
<User profile dir>\AppData\Roaming\Perpetual\
└── *.env
on Windows. The init operation itself does not create this global directory or any global .env file.
Customizable Files
Most files generated by the init operation can be customized to fine-tune Perpetual's behavior for your project:
-
.envfilesPerpetual does not create a project-local
.envfile by default. To configure environment variables, runinitwith the-exflag to generate example files, copy one or more of them to files ending with.env, then edit them as needed.For example:
- Copy
.env.exampleto.envfor general provider-selection settings. - Copy
openai.env.exampletoopenai.envfor OpenAI-specific settings. - Copy
ollama.env.exampletoollama.envfor Ollama-specific settings.
You can merge settings into a single
.envfile or keep them split across multiple*.envfiles.Perpetual loads environment values with the following precedence:
- Existing system environment variables have the highest priority.
- Project-local env files:
<project_root>/.perpetual/*.env - Global env files: e.g.
~/.config/Perpetual/*.envon Linux or<User profile dir>\AppData\Roaming\Perpetual\*.envon Windows
Files are loaded in alphabetical order within each directory. Values loaded earlier take precedence over values loaded later.
- Copy
-
Operation-specific JSON configs
Files like
op_annotate.json,op_implement.json,op_doc.json,op_explain.json, andop_report.jsoncontain prompts, regex patterns, tags, and other settings Perpetual uses when interacting with your source code. You can adjust these to change how Perpetual processes files and communicates with the LLM. -
project.jsonThis file controls project-wide behavior, including:
project_files_whitelist: Regex patterns to include relevant files.project_files_blacklist: Regex patterns to exclude files from processing.project_test_files_blacklist: Regex patterns to exclude test files when operations are run without test inclusion.files_to_md_code_mappings: Maps file path patterns to Markdown code-block languages.filename_tagsandfilename_tags_rx: Tags and regexps used when sending and parsing filenames.delete_tagsanddelete_tags_rx: Tags and regexps used when parsing file-deletion requests from LLM responses.code_tags_rx: Regexps used to parse code blocks from LLM responses.noupload_comments_rx: Regexps for detecting files marked as not uploadable.- Project index and description prompts: Prompt and response text used when providing project structure or project description context to the LLM.
- Context-saving settings: Thresholds and percentages used to reduce LLM context usage for larger projects.
- Incremental file-modification settings: Regexps and minimum file-size mappings used by implementation mode when generating compact search-and-replace changes.
-
description.md.templateThis file is a template for an optional project description. To use it, copy or rename it to
.perpetual/description.mdand edit it for your project. The resultingdescription.mdcan provide additional context to operations such asimplement,explain,doc,annotate, andreport.
These configuration files can be committed to version control to share and track changes across your team. Local .env files should usually not be committed.
Files Not Intended for User Modification
The following are managed automatically by Perpetual and should not be edited manually:
.annotations.json: Stores source-code annotations for your project. Updated via theannotateoperation..embeddings.msgpack: Stores source-code vector embeddings for your project. Updated via theembedoperation..stash/: Contains code backups created during operations. Managed by thestashoperation..message_log.txt*: Logs interactions with the LLM provider for debugging purposes, including rotated log files.
Obsolete Files and Directories
When running init, Perpetual checks the .perpetual directory for deprecated items left over from older versions. It does not remove them automatically; instead, it prints a warning so you can delete them manually.
-
Obsolete Files
filename_embed_regexp.jsonfilename_tags_regexps.jsonfilename_tags.jsonno_upload_comment_regexps.jsonoutput_tags_regexps.jsonproject_files_blacklist.jsonproject_files_to_markdown_lang_mappings.jsonproject_files_whitelist.jsonreasonings_tags_regexps.jsonreasonings_tags.json
-
Obsolete Directories
prompts