Skip to main content
Glama
lazylagom

context-compose

by lazylagom

Context Compose

Composable Contexts for High-Quality, AI-Powered Development

Why Context Compose?

While high-level requirements documents (like PRDs) provide overall project goals, they often lack the detailed, task-specific context needed for day-to-day development. Each unit of work—be it a new feature, a bug fix, or a refactor—requires its own focused set of rules, expert perspectives, and guidelines to ensure consistency and quality.

Context Compose provides a simple yet powerful system for defining, composing, and managing these granular contexts. It's like Docker Compose, but for your AI development workflow.

The Problem:

  • High-level documents are too broad for specific coding tasks.

  • Developers constantly switch between tasks that require different mindsets and rules.

  • Inconsistent approaches across team members for similar tasks lead to quality issues.

  • Repetitive and manual context-setting for AI assistants is time-consuming.

The Solution: Context Compose allows you to define reusable, task-specific contexts that can be composed on demand. This ensures every task is approached with the right expertise and standards, leading to consistent, high-quality results across your entire team.

Related MCP server: Structured Workflow Engine MCP Server

Key Features

  • 🎯 Task-Specific Contexts: Create dedicated contexts for features, bug fixes, refactoring, API design, and more.

  • 🧩 Composable Architecture: Mix and match components—like expert personas, coding rules, and specialized tools—to build the perfect context for any task.

  • 🔧 Fully Customizable: The system is built on a simple directory structure. You can override existing assets or create entirely new categories (e.g., security, testing-philosophy) to fit your project's unique needs.

  • ⌨️ Simple CLI: A straightforward command-line interface (start-context) makes it easy to load contexts and integrate with your existing workflows.

  • 📂 Clear File-Based Structure: All contexts and assets are managed as simple YAML files, making them easy to version control, share, and edit.

MCP Server Integration

To integrate Context Compose with an MCP-compatible client (like an IDE extension), you can register it as an MCP server.

For integration with automated tools, use the following configuration in your settings file:

{
  "mcpServers": {
    "context-compose": {
      "command": "npx",
      "args": ["-y", "@noanswer/context-compose@latest"]
    }
  }
}

This configuration tells the client how to start the context-compose server, ensuring it runs non-interactively.

Project Initialization

Before using contexts, you need to initialize your project. This sets up the necessary .contextcompose directory and default assets.

Copy and paste the following into your prompt to run it.

initialize using context-compose

What happens:

  • The init command runs.

  • A .contextcompose directory is created in your project root.

  • Default assets (personas, rules, etc.) are copied into it, ready for you to use or customize.

How It Works

Context Compose works by reading a main context file and dynamically assembling a final, detailed prompt from various component files. The entire system is driven by a special directory in your project root: .contextcompose/.

  1. The .contextcompose/ Directory: When you start a task, you tell Context Compose which context to use (e.g., feature).

  2. Main Context File: It looks for a corresponding file, like .contextcompose/feature-context.yaml.

  3. The context Block: Inside this file, a context block lists all the components to include. It references other YAML files organized by category (e.g., personas, rules).

  4. Dynamic Composition: The tool reads each referenced file, extracts its prompt, and combines everything into a single, comprehensive prompt.

The best part? It's fully extensible. You can create any category you want. If you add a security: section to your context file, the tool will automatically look for files in a .contextcompose/security/ directory.

Context Structure Example

Here is an example of what a .contextcompose/api-context.yaml file might look like. It defines the context for building a new API endpoint.

# .contextcompose/api-context.yaml
version: 1
kind: context
name: 'api-development'
description: 'Context for creating new API endpoints.'

# This is the base prompt for the main context file itself.
prompt: 'You are building a new API endpoint. Follow all the guidelines provided.'
enhanced-prompt: 'Your mission is to construct a robust, secure, and well-documented API endpoint. Pay close attention to the expert advice from the persona, adhere strictly to all specified rules, and utilize the recommended tools (MCPs).'

# Here we compose the context from other files.
context:
  personas:
    - personas/uncle-bob.yaml
  rules:
    - rules/api-design.yaml
    - rules/clean-code.yaml
  # This is a custom category!
  security:
    - security/owasp-top-10.yaml
  mcps:
    - mcps/sequential-thinking.yaml

🛠️ Customization in Detail

Customizing Context Compose is its core strength. You can override built-in assets or create new ones from scratch.

Scenario: Let's add a new category for "Company-Wide Principles".

  1. Create a New Directory: Inside your project's .contextcompose/ directory, create a new folder named principles.

    .contextcompose/
    ├── principles/
    └── ...
  2. Create Your Asset File: Inside the new directory, create a YAML file. The kind should match the singular version of the directory name.

    # .contextcompose/principles/team-values.yaml
    version: 1
    kind: principle # Matches the 'principles' directory
    name: 'team-values'
    description: 'The core values our engineering team follows.'
    prompt: |
      - Always prioritize clarity over cleverness.
      - Leave code better than you found it.
      - Communicate proactively.
  3. Reference it in Your Context: Now, you can add principles to any *-context.yaml file.

    
    # .contextcompose/feature-context.yaml
    
    version: 1
    kind: context
    name: 'feature'
    
    # ...
    
    context:
      personas: - personas/frontend-expert.yaml
      rules: - rules/typescript-best-practices.yaml
    
      # Your new custom category is now part of the context!
    
      principles: - principles/team-values.yaml
      `When you run`context-compose start-context feature`, the content of `team-values.yaml` will be automatically included in the final prompt.
    
  4. Validate Your Assets

    After creating or modifying asset files, it's a good practice to validate them. Context Compose provides a validate command to check for common errors.

    npx @noanswer/context-compose validate

    This command will check all your asset files inside the .contextcompose directory and verify that:

    • The YAML syntax is correct.

    • All required fields (version, kind, name, description, prompt) are present.

    This helps you catch errors early and ensures your contexts are correctly structured.

🎭 User Scenarios

1. Project Initialization

Before using contexts, you need to initialize your project. This sets up the necessary .contextcompose directory and default assets.

initialize my project using context-compose

What happens:

  • The init command runs.

  • A .contextcompose directory is created in your project root.

  • Default assets (personas, rules, etc.) are copied into it, ready for you to use or customize.

2. Frontend Developer: Building a New React Component

A developer is tasked with building a new search component using React and TypeScript. They would start by telling their AI assistant:

start-context react-feature -e using context-compose

What they get:

  • Guidance from a React Expert Persona on component structure and state management.

  • Strict TypeScript Rules for type safety and best practices.

  • Checklists from Testing Rules to ensure Jest/RTL coverage.

  • A Sequential Thinking framework to break down the task.

3. Backend Developer: Creating a Secure API Endpoint

A developer needs to create a new RESTful API endpoint for user authentication. They would start by telling their AI assistant:

start-context secure-api using context-compose

What they get:

  • Principles from API Design Rules for RESTful patterns.

  • Critical reminders from custom Security Rules based on OWASP guidelines.

  • Best practices from Clean Code Rules for maintainability.

4. Team Lead: Performing a Code Review

A team lead wants to ensure a consistent and thorough code review process. They would start by telling their AI assistant:

start-context code-review using context-compose

What they get:

  • A Code Quality Checklist from the rules to standardize the review.

  • The perspective of an Architecture Expert Persona to check for anti-patterns.

  • Guidelines on providing constructive feedback.

📦 Built-in Assets Structure

Context Compose comes with a set of pre-built assets to get you started. You can use them as is or override them by creating files with the same name in your project's .contextcompose/ directory.

  • assets/personas/: Expert personas providing specialized knowledge (e.g., frontend-expert, backend-expert, devops-expert).

  • assets/rules/: Development guidelines and best practices (e.g., clean-code, api-design, testing-principles).

  • assets/actions/: Definitions for specific AI tasks and operations.

  • assets/mcps/: Integrations with Model Context Protocols for enhanced AI capabilities (e.g., sequential-thinking, web-search).

Available Tools

3 tools
initA

Initialize Context Compose project (copy assets directory to .contextcompose). You must specify the project root directory with the projectRoot parameter.

ParametersJSON Schema
NameRequiredDescriptionDefault
projectRootYesThe root directory for the project. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.
enhancedPromptNoUse enhanced prompts with detailed guidelines instead of simple prompts

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses that the tool copies assets to a hidden directory, which is a key behavior. However, it does not mention idempotency, side effects (e.g., overwriting existing files), or permissions needed, which are important for an initialization tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, front-loads the purpose, and contains no extraneous words. Every sentence contributes essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the core functionality but lacks details about return values (no output schema) and does not mention ordering relative to sibling tools like 'start-context'. For a simple initialization tool, it is adequate but could be more complete by adding a brief note on prerequisites or outcomes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (both parameters are described in the schema). The description repeats the requirement for projectRoot but adds no new meaning beyond the schema. The enhancedPrompt parameter is not mentioned in the description text, but the schema already defines it clearly. Baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool initializes a Context Compose project by copying assets to .contextcompose. The verb 'Initialize' and the specific resource 'Context Compose project' are unambiguous, and the action is sufficiently detailed to distinguish it from sibling tools like 'start-context' and 'validate-context'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions the requirement to set projectRoot, implying when to use the tool, but does not explicitly state when not to use it or how it relates to sibling tools. There is no guidance on ordering or alternatives, leaving room for ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

start-contextA

Start a new context for a task. Reads -context.yaml file from the assets directory. Combines prompts from all referenced files (personas, rules, mcps, actions) to provide context for AI development.

ParametersJSON Schema
NameRequiredDescriptionDefault
contextNameYesName of the context to start (e.g., feature, api, test)
projectRootYesThe directory of the project. Must be an absolute path.
enhancedPromptNoUse enhanced prompts with detailed guidelines instead of simple prompts

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description provides some behavioral detail (reads a YAML file, combines prompts) but lacks disclosure on side effects, permissions, or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences efficiently convey purpose and process with no extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Description covers the core functionality and file processing, though it omits details about return values or error conditions. Acceptable given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the description adds context about the YAML file format and combination logic, enhancing understanding beyond parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool starts a new context, reads a YAML file, and combines prompts. It is specific but does not explicitly differentiate from sibling tools (init, validate-context).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings or alternatives. The description does not specify prerequisites or recommended scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

validate-contextB

Validate a context file and its referenced component files.

ParametersJSON Schema
NameRequiredDescriptionDefault
projectRootYesThe directory of the project. Must be an absolute path.

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description only mentions high-level action without detailing behavior such as side effects, required permissions, or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no extraneous information, efficiently conveying the tool's purpose. However, it could benefit from slightly more detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no output schema), the description is minimally adequate but lacks details on validation outcomes or return behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the description adds no additional meaning beyond what the schema provides for 'projectRoot'. Baseline score is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the verb 'validate' and the resource 'context file and its referenced component files', clearly distinguishing it from siblings like 'init' and 'start-context'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus siblings or when not to use it. The description lacks context for appropriate invocation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv1.8.6
    • First observedinit
    • First observedstart-context
    • First observedvalidate-context

TDQS

A3.7/5.0
Disambiguation5/5

Each tool has a distinct purpose: project initialization, context starting, and validation. No overlapping functionality.

Naming Consistency4/5

Two tools use hyphenated verb-noun ('start-context', 'validate-context') while 'init' is a single verb, but the pattern is clear and predictable.

Tool Count5/5

Three tools are well-scoped for a context management tool, covering setup, usage, and validation without redundancy.

Completeness4/5

Core operations are covered (init, start, validate), but missing potential lifecycle operations like listing or deleting contexts, though not critical for basic use.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Context Engineering Framework that provides 9 battle-tested development workflows with smart validation to help AI models follow consistent processes.
    MIT
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A platform that transforms AI development with intelligent context management, optimization, and prompt engineering, enabling developers to enhance model performance through structured context management and optimization tools.
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lazylagom/context-compose-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server