completion-marker-optimization

Efficient completion marker generation to prevent timeouts and improve task completion reliability. Use when marking tasks complete to ensure atomic completion marker output. Prevents timeout issues and reduces completion time by 10-15 seconds.

16 stars

Best use case

completion-marker-optimization is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Efficient completion marker generation to prevent timeouts and improve task completion reliability. Use when marking tasks complete to ensure atomic completion marker output. Prevents timeout issues and reduces completion time by 10-15 seconds.

Teams using completion-marker-optimization should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/completion-marker-optimization/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/devops/completion-marker-optimization/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/completion-marker-optimization/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How completion-marker-optimization Compares

Feature / Agentcompletion-marker-optimizationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Efficient completion marker generation to prevent timeouts and improve task completion reliability. Use when marking tasks complete to ensure atomic completion marker output. Prevents timeout issues and reduces completion time by 10-15 seconds.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Completion Marker Optimization

Efficient completion marker generation to prevent timeouts and improve task completion reliability. Eliminates timeout issues and reduces completion time by 10-15 seconds.

## ⚠️ CRITICAL PROTOCOL - READ FIRST ⚠️

**THE COMPLETION MARKER MUST BE OUTPUT AS A SINGLE, ATOMIC STRING. STREAMING CHARACTER-BY-CHARACTER VIOLATES THE PROTOCOL AND CAUSES DETECTION FAILURES.**

**Protocol Violation Rate**: 100% of analyzed tasks show streaming violations despite explicit instructions.

**Impact**: 
- Orchestrator may fail to detect completion
- Potential parsing issues
- Token waste (23 tokens → 1 token for marker)
- Timeout issues (15+ seconds)

**CRITICAL RULES**:
1. Buffer the entire marker before outputting
2. Never stream it character-by-character
3. Output the complete string in a single response
4. The orchestrator expects atomic output - streaming may cause detection failures
5. **Output `<ralph>COMPLETE</ralph>` exactly once.** Do not repeat it. Duplicate output is invalid.
6. **Place the marker early** in your final response (e.g. immediately after the verification summary) so that if the response is truncated, completion is still detected.

**Common mistake**: Do not output the marker twice. Invalid example: `<ralph>COMPLETE</ralph><ralph>COMPLETE</ralph>`.

## Overview

**Problem**: Character-by-character streaming causes timeouts (15+ seconds) and protocol violations

**Solution**: Atomic completion marker output as single string

**Impact**: Eliminate timeout issues, reduce completion time by 10-15 seconds, ensure 100% protocol compliance

## Output Format

### Visual Examples: Correct vs Incorrect

**✅ CORRECT: Atomic Output (Single Token)**

The marker is output as one complete string in a single response:

```markdown
## Task Complete

All functionality has been implemented and verified.

<ralph>COMPLETE</ralph>
```

**Token Breakdown (Correct)**: 
- Single token: `<ralph>COMPLETE</ralph>`
- Output in one response
- Orchestrator detects immediately

---

**❌ INCORRECT: Streaming (Multiple Tokens)**

The marker is streamed character-by-character across multiple tokens:

```markdown
<
ral
ph
>COMPLETE</ralph>
```

**Token Breakdown (Incorrect)**:
- Token 1: `<`
- Token 2: `ral`
- Token 3: `ph`
- Token 4: `>COMPLETE</ralph>`
- **Result**: Orchestrator may not detect completion, parsing issues occur

**Why This Fails**:
- Orchestrator expects complete marker in single token
- Streaming violates protocol
- Detection may fail or be delayed
- Wastes tokens (4 tokens vs 1 token)

---

**❌ INCORRECT: Incremental Output**

```markdown
# WRONG: Incremental output
<ralph
>COMPLETE
</ralph>
```

**Token Breakdown (Incorrect)**:
- Token 1: `<ralph`
- Token 2: `>COMPLETE`
- Token 3: `</ralph>`
- **Result**: Protocol violation, detection failure

---

**❌ INCORRECT: Shell Echo Commands**

```bash
# WRONG: Don't use echo
echo "<ralph>COMPLETE</ralph>"
```

**Why This Fails**:
- Shell commands don't output to orchestrator
- Marker must be in assistant response text
- Orchestrator only reads assistant responses, not shell output

## Timing

### Output Immediately After Verification

**Output completion marker immediately after final verification passes:**

```markdown
## Verification Complete

- [x] TypeScript compilation passes
- [x] Browser testing completed
- [x] All success criteria met
- [x] Progress.txt updated

<ralph>COMPLETE</ralph>
```

### Don't Perform Cleanup After Marker

**Signal completion before resource cleanup:**

```markdown
# ✅ CORRECT: Completion before cleanup
<ralph>COMPLETE</ralph>

# Cleanup operations (if needed)
```

**❌ WRONG: Cleanup before completion**

```markdown
# WRONG: Cleanup before completion marker
# Cleanup operations
<ralph>COMPLETE</ralph>
```

## Validation Before Completion

### Pre-Completion Validation Checklist

**CRITICAL: Complete ALL items before outputting marker. This checklist prevents protocol violations.**

**Task Completion Verification**:
- [ ] All success criteria met
- [ ] Functional testing completed
- [ ] TypeScript compilation passed (if applicable)
- [ ] Browser testing completed (if applicable)
- [ ] No console errors
- [ ] Progress.txt updated (if applicable)

**Marker Output Validation**:
- [ ] All operations are complete (no pending tool calls)
- [ ] Marker string is ready: `<ralph>COMPLETE</ralph>`
- [ ] Marker will be output as single atomic string (not streamed)
- [ ] Marker will be included in assistant response text (not shell command)
- [ ] No intermediate text will appear between marker components
- [ ] Complete marker is buffered and ready for atomic output

**Orchestrator Compatibility Check**:
- [ ] Marker is complete string (not partial)
- [ ] No streaming will occur (verified in validation step)
- [ ] Marker format is correct: `<ralph>COMPLETE</ralph>`
- [ ] Marker will be at end of response after all verification

**Only after ALL items above are checked, proceed to output the marker.**

### Verification Pattern

```markdown
## Final Verification

1. **TypeScript Compilation**: ✅ Passes
   ```bash
   npx tsc --noEmit
   # No errors
   ```

2. **Browser Testing**: ✅ Completed
   - All test cases pass
   - No console errors

3. **Success Criteria**: ✅ All met
   - Criterion 1: ✅
   - Criterion 2: ✅
   - Criterion 3: ✅

4. **Progress Tracking**: ✅ Updated
   - progress.txt reflects completion

<ralph>COMPLETE</ralph>
```

## Orchestrator Detection Patterns

### How Orchestrator Detects Completion

The orchestrator scans assistant responses for the completion marker pattern. It expects:

1. **Complete marker in single token**: `<ralph>COMPLETE</ralph>` as one token
2. **In assistant response text**: Not in shell output or tool responses
3. **At end of response**: After all verification and documentation
4. **Atomic output**: No streaming, no partial tokens

### Detection Failure Modes

**Why streaming causes detection failures**:

1. **Token-by-token scanning**: Orchestrator may miss partial tokens
2. **Timing issues**: Incomplete marker may be processed before completion
3. **Parsing errors**: Partial tokens may not match detection pattern
4. **State confusion**: Multiple tokens may confuse detection logic

**Example of detection failure**:
```
Token 1: "<" → Not recognized as marker
Token 2: "ral" → Not recognized as marker  
Token 3: "ph" → Not recognized as marker
Token 4: ">COMPLETE</ralph>" → Pattern incomplete, detection fails
```

**Example of successful detection**:
```
Token 1: "<ralph>COMPLETE</ralph>" → Pattern matched, completion detected ✅
```

### Validation Patterns Before Output

**Pattern 1: Pre-Output Buffer Check**

```markdown
Before outputting:
1. Buffer complete marker: "<ralph>COMPLETE</ralph>"
2. Verify buffer is complete (not partial)
3. Confirm no streaming will occur
4. Output buffered marker atomically
```

**Pattern 2: Response Structure Validation**

```markdown
Response structure (correct):
1. Verification summary
2. Task completion details
3. Atomic marker: <ralph>COMPLETE</ralph>

Response structure (incorrect):
1. Verification summary
2. <ralph (partial token)
3. COMPLETE (partial token)
4. </ralph> (partial token)
```

**Pattern 3: Tool Call Completion Check**

```markdown
Before outputting marker:
1. Verify no pending tool calls
2. All tool calls have completed
3. No async operations in progress
4. All verification steps finished
5. Then output marker atomically
```

## Common Pitfalls

### Pitfall 1: Character-by-Character Streaming

**Problem**: Streaming completion marker character-by-character

**Solution**: Output as single atomic string

```markdown
# ❌ WRONG: Streaming
<ralph>COMPLETE</ralph>
# Each character streamed separately

# ✅ CORRECT: Atomic
<ralph>COMPLETE</ralph>
# Single string output
```

**CRITICAL ENFORCEMENT**: The completion marker `<ralph>COMPLETE</ralph>` MUST be output as a SINGLE, ATOMIC STRING in ONE response. Do NOT stream it character-by-character. The orchestrator expects the complete marker in a single token output.

### Pitfall 2: Echo Commands

**Problem**: Using shell echo commands for completion marker

**Solution**: Include in assistant response text

```bash
# ❌ WRONG: Shell command
echo "<ralph>COMPLETE</ralph>"

# ✅ CORRECT: In response
<ralph>COMPLETE</ralph>
```

### Pitfall 3: Delayed Completion

**Problem**: Delaying completion for cleanup operations

**Solution**: Output completion before cleanup

```markdown
# ❌ WRONG: Cleanup before completion
# Cleanup operations
<ralph>COMPLETE</ralph>

# ✅ CORRECT: Completion before cleanup
<ralph>COMPLETE</ralph>
# Cleanup operations (if needed)
```

## Troubleshooting: When Streaming Cannot Be Prevented

### System-Level Workarounds

**If streaming occurs despite following all guidelines**:

1. **Force Atomic Output Pattern**:
   ```markdown
   ## Completion
   
   Task complete. Marker: <ralph>COMPLETE</ralph>
   ```
   Place marker immediately after short text to reduce streaming risk.

2. **Minimal Context Before Marker**:
   ```markdown
   Complete. <ralph>COMPLETE</ralph>
   ```
   Minimal text before marker reduces chance of streaming.

3. **Single-Line Pattern**:
   ```markdown
   All tasks complete. <ralph>COMPLETE</ralph>
   ```
   Single line reduces token boundary issues.

### Detection of Streaming After Output

**If you suspect streaming occurred**:

1. **Check response structure**: Look for partial marker tokens
2. **Verify marker completeness**: Ensure full `<ralph>COMPLETE</ralph>` present
3. **Check for intermediate text**: No text between marker components
4. **Review token boundaries**: Marker should be single token

### Recovery Strategies

**If streaming is detected**:

1. **Output marker again in next response** (if task still active)
2. **Use minimal context**: Just the marker with minimal text
3. **Document issue**: Note streaming occurred in progress.txt
4. **Verify detection**: Check if orchestrator detected completion

### Common Streaming Scenarios

**Scenario 1: Long Response Before Marker**
- **Problem**: Long verification text may cause streaming
- **Solution**: Keep verification concise, place marker immediately after

**Scenario 2: Multiple Tool Calls Before Marker**
- **Problem**: Tool call results may trigger streaming
- **Solution**: Complete all tool calls, then output marker in separate response

**Scenario 3: Code Blocks Before Marker**
- **Problem**: Code blocks may cause token boundary issues
- **Solution**: Place marker after code blocks, use minimal text

## Pre-Output Validation Checklist

**Before outputting completion marker, verify ALL of the following**:

**Task Completion**:
- [ ] All operations are complete (no pending tool calls)
- [ ] All success criteria are met
- [ ] TypeScript compilation passed (if applicable)
- [ ] Browser testing completed (if applicable)
- [ ] No console errors
- [ ] Progress.txt updated (if applicable)

**Marker Output Validation**:
- [ ] Marker string is complete: `<ralph>COMPLETE</ralph>`
- [ ] Marker is buffered and ready (not partial)
- [ ] Marker will be output as single atomic string
- [ ] Marker will be included in assistant response (not shell command)
- [ ] No streaming will occur (complete string output)
- [ ] No intermediate text between marker components

**Orchestrator Compatibility**:
- [ ] Marker format is correct: `<ralph>COMPLETE</ralph>`
- [ ] Marker will be at end of response
- [ ] No tool calls will occur after marker
- [ ] Response structure is correct (verification → marker)

**Only after ALL items above are checked, output the marker**:

```markdown
<ralph>COMPLETE</ralph>
```

## Best Practices

1. **Output as atomic string**: Single `<ralph>COMPLETE</ralph>` string - CRITICAL REQUIREMENT
2. **Include in response**: Don't use shell commands
3. **Output immediately**: After final verification passes
4. **Before cleanup**: Signal completion before resource cleanup
5. **Verify first**: All criteria met before completion marker (use checklist above)
6. **Don't stream**: Avoid character-by-character output - PROTOCOL VIOLATION
7. **Don't delay**: Output immediately after verification
8. **Validate before output**: Use pre-output validation checklist
9. **Orchestrator compatibility**: Ensure single token output for orchestrator detection

## Integration with Other Skills

- **task-verification-workflow**: Uses completion marker after verification
- **pre-implementation-check**: Completes after verification
- **testing-fallback-strategies**: Completes after fallback verification

## Related Skills

- `task-verification-workflow` - Task completion verification
- `pre-implementation-check` - Pre-task verification
- `testing-fallback-strategies` - Testing verification

## Remember

1. **Output atomically**: Single string, not streamed
2. **Include in response**: Not via shell commands
3. **Output immediately**: After verification passes
4. **Before cleanup**: Signal completion first
5. **Verify first**: All criteria met
6. **Prevent timeouts**: Atomic output prevents streaming delays

Related Skills

database-cloud-optimization-cost-optimize

16
from diegosouzapw/awesome-omni-skill

You are a cloud cost optimization expert specializing in reducing infrastructure expenses while maintaining performance and reliability. Analyze cloud spending, identify savings opportunities, and ...

cost-optimization

16
from diegosouzapw/awesome-omni-skill

Optimize cloud costs through resource rightsizing, tagging strategies, reserved instances, and spending analysis. Use when reducing cloud expenses, analyzing infrastructure costs, or implementing c...

web-performance-optimization

16
from diegosouzapw/awesome-omni-skill

Optimize website and web application performance including loading speed, Core Web Vitals, bundle size, caching strategies, and runtime performance

verification-before-completion

16
from diegosouzapw/awesome-omni-skill

Use when finishing any task. Final checklist before marking complete. Ensures nothing forgotten, all tests pass, documentation updated.

python-performance-optimization

16
from diegosouzapw/awesome-omni-skill

Profile and optimize Python code using cProfile, memory profilers, and performance best practices. Use when debugging slow Python code, optimizing bottlenecks, or improving application performance.

performance-optimization

16
from diegosouzapw/awesome-omni-skill

Optimize Node.js application performance with caching, clustering, profiling, and monitoring techniques

freight-optimization

16
from diegosouzapw/awesome-omni-skill

When the user wants to optimize freight transportation, reduce shipping costs, or improve carrier selection. Also use when the user mentions "freight management," "carrier optimization," "mode selection," "LTL/TL optimization," "freight consolidation," "load planning," or "transportation procurement." For local delivery routes, see route-optimization. For last-mile, see last-mile-delivery.

database-optimization

16
from diegosouzapw/awesome-omni-skill

Use when optimizing database queries, indexes, N+1 problems, slow queries, or analyzing query performance. Triggers on keywords like "slow query", "N+1", "index", "query optimization", "database performance", "eager loading".

data-sql-optimization

16
from diegosouzapw/awesome-omni-skill

Production-grade SQL optimization for OLTP systems: EXPLAIN/plan analysis, balanced indexing, schema and query design, migrations, backup/recovery, HA, security, and safe performance tuning across PostgreSQL, MySQL, SQL Server, Oracle, SQLite.

context-optimization

16
from diegosouzapw/awesome-omni-skill

Apply compaction, masking, and caching strategies

bazel-build-optimization

16
from diegosouzapw/awesome-omni-skill

Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.

app-store-optimization

16
from diegosouzapw/awesome-omni-skill

Complete App Store Optimization (ASO) toolkit for researching, optimizing, and tracking mobile app performance on Apple App Store and Google Play Store