openclaw - 💡(How to fix) Fix [Feature Request] Workspace Template Inheritance and Gene Modularization [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61655Fetched 2026-04-08 02:56:22
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Request for workspace template inheritance and gene modularization to enable reusable, composable agent configurations that can evolve and combine over time.


Root Cause

Request for workspace template inheritance and gene modularization to enable reusable, composable agent configurations that can evolve and combine over time.


Fix Action

Fix / Workaround

  • Resolved configuration is cached for performance
  • Changes to parent templates propagate to children on next load
  • Gene conflicts are resolved by order of inclusion (last wins)
  • Mutation history is preserved for rollback

Code Example

# workspace-secretary-main/AGENTS.md
---
inherits: base-agent
name: secretary-main
---

## Role
Coordinates tasks and spawns specialized agents.

## Additional Rules
- Always use isolated sessions for cron tasks

---

# templates/base-agent/AGENTS.md
---
name: base-agent
---

## Core Rules
- Reply in current session by default
- Check MEMORY.md before answering questions about prior work
- Never share sensitive information
- Respect workspace boundaries

---

# genes/time-awareness.md
---
gene:
  id: time-awareness
  category: behavior
---

## Time Calculation Rules
- Use Beijing time (Asia/Shanghai) for "X minutes later"
- Calculate: current_beijing_time + X minutes
- Never use UTC for user-facing time references

## CLI Command

---



---

# genes/cron-safety.md
---
gene:
  id: cron-safety
  category: workflow
---

## Cron Task Rules
- Always use `sessionTarget: "isolated"`
- Always use `payload.kind: "agentTurn"`
- Reset `state.consecutiveErrors` to 0 when fixing
- Never set `state.lastError` to "disabled"

---

# workspace-sysadmin/AGENTS.md
---
inherits: base-agent
genes:
  - time-awareness
  - cron-safety
  - security-guard
---

---

# workspace-hybrid-writer/AGENTS.md
---
inherits:
  parents:
    - writer-iso
    - editor-iso
  crossover:
    - source: writer-iso
      traits: [writing-style, creativity]
    - source: editor-iso
      traits: [quality-check, grammar-rules]
---

---

# workspace-writer-v2/AGENTS.md
---
inherits: writer-v1
mutations:
  - target: temperature
    change: +0.1
    reason: "A/B test showed 0.8 performs better"
  - target: systemPrompt
    change: "append"
    value: "\n\nImportant: Always verify facts before writing."
    reason: "Reduced hallucination by 15%"
---

---

~/.openclaw/
├── templates/                    # Base templates
│   ├── base-agent/
│   │   ├── AGENTS.md
│   │   └── SOUL.md
│   └── base-coder/
│       └── AGENTS.md
├── genes/                        # Reusable gene modules
│   ├── time-awareness.md
│   ├── cron-safety.md
│   ├── security-guard.md
│   └── writing-style/
│       ├── technical.md
│       └── conversational.md
└── workspaces/
    ├── workspace-sysadmin/
    │   └── AGENTS.md            # inherits + genes
    └── workspace-secretary-main/
        └── AGENTS.md

---

# Create workspace from template
openclaw workspace create --template base-agent --name my-agent

# Add gene to workspace
openclaw workspace add-gene --workspace sysadmin --gene time-awareness

# View inheritance chain
openclaw workspace lineage --workspace secretary-main

# Create crossover workspace
openclaw workspace crossover --parent1 writer-iso --parent2 editor-iso --output hybrid-writer

# View effective configuration (resolved)
openclaw workspace resolve --workspace sysadmin
RAW_BUFFERClick to expand / collapse

Summary

Request for workspace template inheritance and gene modularization to enable reusable, composable agent configurations that can evolve and combine over time.


Problem Statement

Currently, workspace configurations are monolithic:

  • Each agent has its own AGENTS.md, SOUL.md, TOOLS.md, MEMORY.md
  • No way to inherit or compose traits from other workspaces
  • Changes must be manually replicated across all related agents
  • No systematic way to track which "genes" (traits) come from which lineage

This makes it difficult to:

  1. Share common behaviors across multiple agents
  2. Evolve configurations through mutation/crossover
  3. Track which configuration changes improved performance

Proposed Solution

1. Template Inheritance

Allow workspaces to inherit from parent templates:

# workspace-secretary-main/AGENTS.md
---
inherits: base-agent
name: secretary-main
---

## Role
Coordinates tasks and spawns specialized agents.

## Additional Rules
- Always use isolated sessions for cron tasks
# templates/base-agent/AGENTS.md
---
name: base-agent
---

## Core Rules
- Reply in current session by default
- Check MEMORY.md before answering questions about prior work
- Never share sensitive information
- Respect workspace boundaries

Result: secretary-main inherits all rules from base-agent and adds its own.


2. Gene Modularization

Break down configurations into reusable "genes":

# genes/time-awareness.md
---
gene:
  id: time-awareness
  category: behavior
---

## Time Calculation Rules
- Use Beijing time (Asia/Shanghai) for "X minutes later"
- Calculate: current_beijing_time + X minutes
- Never use UTC for user-facing time references

## CLI Command
```bash
NOW_BEIJING=$(TZ=Asia/Shanghai date +%s)
TARGET_BEIJING=$((NOW_BEIJING + 180))
TARGET_UTC=$(date -u -r $TARGET_BEIJING '+%Y-%m-%dT%H:%M:%SZ')

```yaml
# genes/cron-safety.md
---
gene:
  id: cron-safety
  category: workflow
---

## Cron Task Rules
- Always use `sessionTarget: "isolated"`
- Always use `payload.kind: "agentTurn"`
- Reset `state.consecutiveErrors` to 0 when fixing
- Never set `state.lastError` to "disabled"

Usage in workspace:

# workspace-sysadmin/AGENTS.md
---
inherits: base-agent
genes:
  - time-awareness
  - cron-safety
  - security-guard
---

3. Template Crossover

Combine successful traits from multiple parents:

# workspace-hybrid-writer/AGENTS.md
---
inherits:
  parents:
    - writer-iso
    - editor-iso
  crossover:
    - source: writer-iso
      traits: [writing-style, creativity]
    - source: editor-iso
      traits: [quality-check, grammar-rules]
---

4. Template Mutation

Track and apply variations:

# workspace-writer-v2/AGENTS.md
---
inherits: writer-v1
mutations:
  - target: temperature
    change: +0.1
    reason: "A/B test showed 0.8 performs better"
  - target: systemPrompt
    change: "append"
    value: "\n\nImportant: Always verify facts before writing."
    reason: "Reduced hallucination by 15%"
---

Directory Structure

~/.openclaw/
├── templates/                    # Base templates
│   ├── base-agent/
│   │   ├── AGENTS.md
│   │   └── SOUL.md
│   └── base-coder/
│       └── AGENTS.md
├── genes/                        # Reusable gene modules
│   ├── time-awareness.md
│   ├── cron-safety.md
│   ├── security-guard.md
│   └── writing-style/
│       ├── technical.md
│       └── conversational.md
└── workspaces/
    ├── workspace-sysadmin/
    │   └── AGENTS.md            # inherits + genes
    └── workspace-secretary-main/
        └── AGENTS.md

CLI Commands

# Create workspace from template
openclaw workspace create --template base-agent --name my-agent

# Add gene to workspace
openclaw workspace add-gene --workspace sysadmin --gene time-awareness

# View inheritance chain
openclaw workspace lineage --workspace secretary-main

# Create crossover workspace
openclaw workspace crossover --parent1 writer-iso --parent2 editor-iso --output hybrid-writer

# View effective configuration (resolved)
openclaw workspace resolve --workspace sysadmin

Benefits

  1. DRY (Don't Repeat Yourself): Common rules defined once
  2. Evolvability: Track mutations and their impact
  3. Composability: Mix and match genes for different agent types
  4. Auditability: Clear lineage of where traits come from
  5. A/B Testing: Easy to create variants for comparison

Implementation Notes

  • Resolved configuration is cached for performance
  • Changes to parent templates propagate to children on next load
  • Gene conflicts are resolved by order of inclusion (last wins)
  • Mutation history is preserved for rollback

Priority

Medium-High - This would significantly reduce configuration duplication and enable systematic evolution of agent behaviors.

extent analysis

TL;DR

Implement template inheritance and gene modularization to enable reusable and composable agent configurations.

Guidance

  • Introduce a templates directory to store base templates, such as base-agent and base-coder, to reduce configuration duplication.
  • Create a genes directory to store reusable gene modules, such as time-awareness and cron-safety, to enable composability.
  • Use the inherits keyword in workspace configurations to inherit traits from parent templates.
  • Utilize the genes keyword to include reusable gene modules in workspace configurations.

Example

# workspace-sysadmin/AGENTS.md
---
inherits: base-agent
genes:
  - time-awareness
  - cron-safety
---

Notes

The proposed solution requires updates to the directory structure and the introduction of new keywords, such as inherits and genes, to enable template inheritance and gene modularization.

Recommendation

Apply the proposed solution to implement template inheritance and gene modularization, as it addresses the current limitations of monolithic workspace configurations and enables reusable and composable agent configurations.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING