How to Configure AI-DLC Rule Loading for Cline IDE
AI-DLC rule loading for Cline IDE operates through a hidden .clinerules directory that the Cline extension (saoudrizwan.claude-dev) automatically discovers and loads into its system-level prompt when VS Code starts, requiring no API calls or environment variables.
The awslabs/aidlc-workflows repository provides a complete automation harness for implementing AI-DLC (AI-Driven Documentation and Lifecycle Control) methodologies within Visual Studio Code. Configuring AI-DLC rule loading for Cline IDE involves understanding how the adapter creates a temporary workspace, injects rule files into a specific hidden directory, and launches the editor so the extension automatically ingests the methodology constraints.
Understanding the File-Based Rule Loading Mechanism
The Cline adapter drives AI-DLC workflows by leveraging a purely file-based configuration system. Unlike other integrations that might require REST APIs or complex authentication, the Cline extension reads rules directly from the filesystem.
When the adapter launches VS Code with a workspace containing a .clinerules folder, the extension immediately loads those files into its system prompt. This mechanism ensures that Claude (the underlying AI model) follows the specific constraints, coding standards, and documentation requirements defined in your AI-DLC rule set.
The rule-loading process consists of three distinct phases handled by the adapter:
- Directory definition — Establishing the
.clinerulestarget location - File injection — Copying rules from your source location to the workspace
- Automatic ingestion — Cline reading the rules on workspace startup
Step-by-Step Configuration Process
Define the Rules Sub-Directory
The adapter establishes the directory name through the _RULES_SUBDIR constant defined in cline.py.
# From scripts/aidlc-evaluator/packages/ide-harness/src/ide_harness/adapters/cline.py (line 54)
_RULES_SUBDIR = ".clinerules"
This constant determines the exact folder name that Cline expects. The adapter uses this value to create the hidden directory inside the temporary workspace, ensuring compatibility with the extension's auto-discovery mechanism.
Copy Rules into the Workspace
The private method _inject_clinerules handles the actual file operations, starting at line 70 in cline.py. This method accepts either a single rule file or an entire directory structure containing multiple rule files.
The implementation logic works as follows:
- Creates the
.clinerulesdirectory inside the temporary workspace (workspace / ".clinerules") - If
rules_pathpoints to a file, it copies that file directly usingshutil.copy2 - If
rules_pathpoints to a directory, it recursively copies all files while preserving sub-directory structures - Logs the injection location via
logger.infofor debugging purposes
This flexibility allows you to organize rules as either monolithic files or modular directory hierarchies depending on your methodology complexity.
Launch VS Code with Auto-Loading
After rule injection completes, the adapter launches VS Code using subprocess.Popen at lines 32-34:
# Simplified from cline.py
subprocess.Popen(
["code", "--wait", str(workspace)],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
The --wait flag ensures the adapter pauses until you close the VS Code window, while the workspace path argument ensures Cline opens with your temporary folder as the active workspace. Because .clinerules exists in the root of this workspace, the extension automatically loads the rules into its system prompt before you begin interacting with the AI.
Complete Implementation Example
Below is a minimal Python implementation demonstrating how to configure the adapter to load your AI-DLC rules:
from pathlib import Path
from ide_harness.registry import AdapterRegistry
from ide_harness.adapter import AdapterConfig
# Configure paths to your AI-DLC assets
config = AdapterConfig(
vision_path=Path("docs/vision.md"),
tech_env_path=Path("docs/tech-env.md"),
rules_path=Path("aidlc-rules/"), # Directory or single file
output_dir=Path("output/"), # Target for generated docs
timeout_seconds=300,
)
# Execute the Cline adapter
cline_adapter = AdapterRegistry.get("Cline")
result = cline_adapter.run(config)
print("Documentation generated:", result.success)
print("Output location:", result.aidlc_docs_dir)
When executed, this script:
- Creates a temporary workspace named
aidlc-cline-XXXXXX - Copies your vision document, technical environment specs, and rules into the workspace
- Populates
.clinerules/with your methodology constraints - Opens VS Code with the Cline extension automatically loading the rules
- Polls for completion and normalizes output in
aidlc-docs/after VS Code closes
Prerequisites and Validation
Before running the configuration, the adapter performs prerequisite checks via check_prerequisites():
- VS Code CLI availability — Verifies
codeexists on yourPATH - Extension presence — Warns if the Cline extension (
saoudrizwan.claude-dev) is not installed, though it does not block execution
The temporary workspace preparation also handles the creation of INSTRUCTIONS.md, which contains the rendered AI-DLC prompt. This file serves as a reference for operators who need to manually paste prompts into Cline's chat panel during interactive sessions.
Source Code Architecture
Understanding the file structure helps when customizing or debugging the configuration:
| File | Purpose | Critical Components |
|---|---|---|
scripts/aidlc-evaluator/packages/ide-harness/src/ide_harness/adapters/cline.py |
Main adapter implementation | _RULES_SUBDIR (line 54), _inject_clinerules (line 70), subprocess.Popen launch (lines 32-34) |
scripts/aidlc-evaluator/packages/ide-harness/src/ide_harness/adapter.py |
Abstract base class | AdapterConfig dataclass, AdapterResult structure |
scripts/aidlc-evaluator/packages/ide-harness/src/ide_harness/registry.py |
Adapter factory | Maps "Cline" string to adapter class |
aidlc-rules/ |
Default rule location | Shipped methodology files for AI-DLC compliance |
The output detection mechanism monitors the aidlc-docs/ directory within the workspace. Once sufficient files appear (or VS Code exits), the adapter normalizes the generated documentation and copies it to your specified output_dir.
Summary
- AI-DLC rule loading for Cline IDE relies on a hidden
.clinerulesdirectory that the Cline extension auto-discovers on startup. - The
_inject_clinerulesmethod incline.py(line 70) handles copying rules from your source location to this hidden directory. - You can supply rules as either a single file or a directory structure—the adapter handles both via
shutil.copy2and recursive copying. - The mechanism requires no APIs or environment variables; simply ensure your
rules_pathargument points to valid AI-DLC rule files when constructing theAdapterConfig.
Frequently Asked Questions
What directory name does Cline expect for AI-DLC rules?
Cline expects a hidden directory named exactly .clinerules in the workspace root. The adapter defines this via the _RULES_SUBDIR constant in cline.py (line 54) and creates it automatically via the _inject_clinerules method. Do not rename this folder, as the Cline extension specifically scans for this exact directory name on startup.
Can I use a single rule file instead of an entire directory?
Yes. The _inject_clinerules method accepts both files and directories via the rules_path parameter. If you provide a file path, the adapter copies it directly into .clinerules/. If you provide a directory, it recursively copies all contents while preserving the internal folder structure. Both approaches trigger the same automatic loading behavior when VS Code launches.
How does the adapter validate that Cline is properly installed?
The check_prerequisites() method verifies two conditions: first, that the code CLI command is available on your system's PATH, and second, that the Cline extension (saoudrizwan.claude-dev) is installed. While missing extensions generate warnings, the adapter will still attempt to launch VS Code, allowing you to install the extension manually if needed.
Where does the generated documentation output appear?
The adapter monitors the aidlc-docs/ directory within the temporary workspace for generated files. Once detected (or when VS Code exits), it normalizes the content and copies everything to the output_dir specified in your AdapterConfig. You can access the final documentation path via result.aidlc_docs_dir in the returned result object.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →