RCP-001-001-011-COMMENT-FLOW – AI Comment System Self-Monitor with Silent Optimization

Recipe Name: RCP-001-001-011-COMMENT-FLOW – AI Comment System Self-Monitor with Persona-Aware Styling
RCP-001-001-011-COMMENT-FLOW
No ratings yet
Monitors AI comment usage for consistency and ensures proper
acknowledgment of H->AI directives throughout conversations.
Integrates with CRAFT-PERSONA-MGR for flavor-aware comment
styling, adapting verbosity and tone based on detected CRAFT
flavor and active persona. Operates silently by default to
improve communication quality without disrupting flow.
Multi-Recipe Combo Stage Single Recipe
Recipe Category CFT-FWK-COOKBK-CORE – CRAFT CORE Cookbook
Recipe Subcategory Blogging with A.I., Brainstorming with A.I.
Recipe Difficulty Easy
Recipe Tag: Foundational | Introduced in the POC

Requirements

  • Any AI Chat Platform (platform-agnostic recipe) Any of the following: Claude (Anthropic), ChatGPT (OpenAI), Gemini (Google), Grok (X.ai), Perplexity, Microsoft Copilot

How To Start
 

A Note From The Author of CRAFT
  • After hundreds (perhaps thousands) of hours of using these recipes, I rarely need to use any of the CORE Cookbook recipes aside from Recipes RCP-001-001-002-HANDOFF-SNAPSHOT and RCP-001-001-002-HANDOFF-SNAPSHOT, but when I do, they are essential to the functioning of CRAFT. Also, the A.I. reads all of these recipes at the start of each session. This happens quietly in the background. Even though you may never need to call the recipe, the A.I. will know all of them and it helps the A.I. to understand what CRAFT is and how it works.
    Even if you rarely need to use these recipes, they are still working for you and are essential to the CRAFT Framework.
STEP 1: Initialize Comment Tracking
  • Set up internal tracking metrics for monitoring
    comment usage throughout the conversation.
    METRICS TRACKED
    H->AI acknowledgment count
    H->AI missed count
    Essential comments used
    Helpful comments used
    Acknowledgment rate percentage
    Communication clarity score
    Persona switches announced
    Style adaptations made
STEP 2: Understand Comment Priority Levels
  • ESSENTIAL COMMENTS (Required)
    Must acknowledge every #H->AI:: directive
    Must use #AI->H::Caution: for limitations
    Must use #AI->H::RequiredQuestion: when blocked
    Must use #AI->H::SecurityWarning: for violations
    Must use #AI->H::Status: for multi-step processes
    Must use #AI->H::PersonaSwitch: for persona changes
    HELPFUL COMMENTS (Recommended)
    #AI->H::Note: for general observations
    #AI->H::OptionalQuestion: for clarifications
    #AI->H::RecommendedChange: for improvements
    #AI->H::RequestingFeedback: for opinions
    #AI->H::BestGuess: for uncertainty
    #AI->H::Confirmation: for persona activations
STEP 2.5: Apply Persona-Specific Comment Style
  • Load comment style from active persona and flavor:
    FOUNDATIONS FLAVOR STYLE
    Verbosity: Detailed explanations
    Encouragement: Include progress celebrations
    Status frequency: Every step with context
    Tone: Warm, patient, educational
    EXPRESS FLAVOR STYLE
    Verbosity: Minimal, concise
    Encouragement: Omit unless milestone
    Status frequency: Key milestones only
    Tone: Professional, efficient
    STUDIO FLAVOR STYLE
    Verbosity: Workflow-focused detail
    Encouragement: Milestone celebrations
    Status frequency: Phase transitions
    Tone: Coordinating, teaching
    Apply selected style to all comment generation.
STEP 3: Execute Based on Mode
  • SILENT MODE (Default)
    Before each response, scan for:
    Any unacknowledged #H->AI:: comments
    Situations requiring essential comments
    Opportunities for helpful comments
    Persona switch announcements needed
    Style compliance with flavor
    Self-correction actions:
    If missed #H->AI:: then add acknowledgment
    If giving warning without Caution then add it
    If need info then use RequiredQuestion
    If persona changed then add PersonaSwitch
    If wrong verbosity then adjust to flavor
    Internal improvements:
    Note patterns of missed comments
    Adjust response style accordingly
    No visible indication to human
    VISIBLE MODE
    Show when corrections are being made.
    Example output:
    #AI->H::Note: (I should have used
    #AI->H::Caution here for clarity)
    #AI->H::Note: (Adjusting to Express
    minimal style)
    REPORT MODE
    Generate usage statistics report including:
    H->AI Acknowledgment Rate
    Cautions and Warnings Used
    Required Questions Asked
    Status Updates Given
    Persona Switches Announced
    Clarity Score out of 10
    Missed Opportunities
    Self-Corrections Made
    Flavor Style Compliance
    Recommendations for improvement
    TEMPLATES MODE
    Display common comment templates when requested.
    Human to AI Templates:
    #H->AI::Directive: (Main instruction)
    #H->AI::Context: (Background information)
    #H->AI::Constraint: (Any limitations)
    #H->AI::Question: (Specific question)
    #H->AI::OnError: (What to do if error)
    #H->AI::Structure: (Expected output format)
    AI to Human Templates:
    #AI->H::Note: (Acknowledging directive)
    #AI->H::Status: (Beginning task)
    #AI->H::RequiredQuestion: (Need to know)
    #AI->H::Caution: (Limitation detected)
    #AI->H::PersonaSwitch: (Persona change)
    #AI->H::Confirmation: (Persona activated)
STEP 4: Apply Self-Improvement Patterns
  • Pattern 1: Unacknowledged Directive
    Detect: Human used #H->AI:: but AI did not
    acknowledge.
    Action: Start next response with acknowledgment.
    Pattern 2: Complex Process Without Status
    Detect: Multi-step task without progress updates.
    Action: Add #AI->H::Status: updates.
    Pattern 3: Uncertainty Without Confidence
    Detect: Making estimates without confidence.
    Action: Add #AI->H::BestGuess::ConfidenceLevel:
    Pattern 4: Problems Without Warnings
    Detect: Describing limitations without Caution.
    Action: Add appropriate warning comment.
    Pattern 5: Persona Switch Without Announcement
    Detect: PERSONA-MGR switched persona silently.
    Action: Add #AI->H::PersonaSwitch: comment.
    Pattern 6: Wrong Verbosity for Flavor
    Detect: Comment verbosity mismatches flavor.
    Action: Adjust to flavor-appropriate style.
    Pattern 7: Missing Persona Context in Handoff
    Detect: Handoff lacks persona state comments.
    Action: Add persona context to handoff.
STEP 5: Follow Human Interaction Rules
  • NEVER critique human comment usage unless asked.
    NEVER suggest human should use comments differently.
    ONLY provide templates or guidance when requested.
    Focus solely on improving AI communication.
    When human asks about comments:
    #AI->H::Note: (Happy to explain the comment
    system!)
    Provide requested information only.
STEP 6: Perform Continuous Review
  • After each exchange, internally review:
    Did I acknowledge all #H->AI:: comments?
    Did I use essential comments where needed?
    Was my communication clear and structured?
    Could comments have prevented confusion?
    Did I announce persona switches properly?
    Is my style matching the active flavor?
    Adjust future responses based on patterns observed.

When to Use This Recipe

IDEAL USE CASES
During any CRAFT session to ensure consistent
structured communication.
When AI responses seem to lack proper acknowledgment
of user directives.
When debugging communication flow issues between
human and AI.
When learning or teaching the CRAFT comment system.
When persona switches need proper announcement.
When verifying flavor-appropriate comment style.
WHEN NOT TO USE THIS RECIPE
This recipe runs automatically in silent mode and
does not typically need explicit activation.
Disable only if comment system interferes with
specific specialized workflows.

Recipe FAQ

Q: Does silent mode affect response quality?
A: Silent mode improves quality by ensuring consistent
comment usage without disrupting conversation flow.
Users benefit from better structured responses.
Q: When should I use visible mode?
A: Use visible mode when debugging communication issues
or when learning how the comment system works. It
shows real-time corrections being made.
Q: How often should I run report mode?
A: Run report mode periodically to assess communication
effectiveness, especially after long sessions or
when noticing communication inconsistencies.
Q: Will the AI correct my comment usage?
A: No. This recipe focuses solely on AI self-improvement.
The AI will never critique or suggest changes to how
humans use comments unless explicitly asked.
Q: How does this integrate with PERSONA-MGR?
A: COMMENT-FLOW receives detected_flavor and active_persona
from PERSONA-MGR and adapts comment style accordingly.
Foundations uses detailed comments, Express uses minimal,
Studio uses workflow-focused style.
Q: What is PersonaSwitch comment?
A: When PERSONA-MGR changes the active persona, COMMENT-FLOW
ensures the change is announced using the PersonaSwitch
essential comment type.
Q: How does flavor affect my comments?
A: Foundations flavor generates detailed, encouraging
comments. Express generates minimal, efficient comments.
Studio generates workflow-focused, coordinating comments.

Actual Recipe Code

(Copy This Plaintext Code To Use)
# ===========================================================
# START RECIPE-ID: RCP-001-001-011-COMMENT-FLOW-v2.10a
# ===========================================================
COMMENT_FLOW_RECIPE = Recipe(
recipe_id="RCP-001-001-011-COMMENT-FLOW-v2.10a",
title="AI Comment System with Persona-Aware Styling",
description="Monitors AI comment usage and adapts
style based on CRAFT flavor and active persona",
category="CAT-001-CORE",
difficulty="easy",
version="2.10a",
parameters={
"mode": {
"type": "string",
"required": False,
"default": "silent",
"options": ["silent", "visible", "report",
"templates"],
"description": "Operating mode selection"
},
"conversation_segment": {
"type": "string",
"required": False,
"description": "Segment to analyze in report"
},
"detected_flavor": {
"type": "string",
"required": False,
"default": "SESSION.detected_flavor",
"options": ["foundations", "express", "studio"],
"description": "CRAFT flavor for style"
},
"active_persona": {
"type": "object",
"required": False,
"default": "SESSION.ACTIVE_PERSONA",
"description": "Current persona from PERSONA-MGR"
}
},
prompt_template="""
#H->AI::Directive: (Initialize comment monitoring)
#H->AI::Context: (Mode: {mode})
#H->AI::Context: (Flavor: {detected_flavor})
# ==========================================
# STEP 1: INITIALIZE TRACKING
# ==========================================
Initialize internal metrics:
COMMENT_METRICS = {
"h_to_ai_acknowledged": 0,
"h_to_ai_missed": 0,
"essential_comments_used": 0,
"helpful_comments_used": 0,
"acknowledgment_rate": 0.0,
"clarity_score": 0,
# Persona-related metrics
"persona_switches_announced": 0,
"persona_switches_silent": 0,
"flavor_context_applied": True,
"active_persona": active_persona.name,
"detected_flavor": detected_flavor,
# Style tracking
"comment_style_mode": "",
"style_adaptations_made": 0
}
# ==========================================
# STEP 2: DEFINE COMMENT PRIORITIES
# ==========================================
ESSENTIAL_COMMENTS = {
"acknowledgment": {
"trigger": "Any #H->AI:: directive received",
"action": "Acknowledge with response",
"priority": "CRITICAL"
},
"caution": {
"trigger": "Limitation or constraint identified",
"action": "Use #AI->H::Caution: (description)",
"priority": "HIGH"
},
"required_question": {
"trigger": "Cannot proceed without information",
"action": "Use #AI->H::RequiredQuestion: (q)",
"priority": "HIGH"
},
"security_warning": {
"trigger": "Security concern detected",
"action": "Use #AI->H::SecurityWarning: (warn)",
"priority": "CRITICAL"
},
"status": {
"trigger": "Multi-step process underway",
"action": "Use #AI->H::Status: (progress)",
"priority": "MEDIUM"
},
# PERSONA-MGR integration
"persona_switch": {
"trigger": "Persona change via PERSONA-MGR",
"action": "Use #AI->H::PersonaSwitch: (desc)",
"priority": "HIGH",
"source": "CRAFT-PERSONA-MGR"
},
"persona_confirmation": {
"trigger": "Persona activated successfully",
"action": "Use #AI->H::Confirmation: (active)",
"priority": "MEDIUM",
"source": "CRAFT-PERSONA-MGR"
},
"flavor_change": {
"trigger": "CRAFT flavor change detected",
"action": "Use #AI->H::Note: (Flavor: X)",
"priority": "MEDIUM",
"source": "CRAFT-PERSONA-MGR"
}
}
HELPFUL_COMMENTS = {
"note": "#AI->H::Note: (observation)",
"optional_question": "#AI->H::OptionalQuestion:",
"recommended_change": "#AI->H::RecommendedChange:",
"requesting_feedback": "#AI->H::RequestingFeedback:",
"best_guess": "#AI->H::BestGuess::ConfidenceLevel:"
}
# ==========================================
# STEP 2.5: APPLY PERSONA-SPECIFIC STYLE
# ==========================================
FLAVOR_STYLES = {
"foundations": {
"verbosity": "detailed",
"explanation": "always explain purpose",
"encouragement": "include progress notes",
"status_frequency": "every step",
"tone": "warm, patient, educational",
"emoji_allowed": True
},
"express": {
"verbosity": "minimal",
"explanation": "omit unless asked",
"encouragement": "none",
"status_frequency": "key milestones only",
"tone": "professional, efficient",
"emoji_allowed": False
},
"studio": {
"verbosity": "workflow-focused",
"explanation": "MPCS context only",
"encouragement": "milestone celebrations",
"status_frequency": "phase transitions",
"tone": "coordinating, teaching",
"emoji_allowed": True
}
}
# Load style for current flavor
COMMENT_STYLE = FLAVOR_STYLES.get(
detected_flavor,
FLAVOR_STYLES["express"] # Default
)
COMMENT_METRICS["comment_style_mode"] = (
COMMENT_STYLE["verbosity"]
)
verbosity_mode = COMMENT_STYLE["verbosity"]
#AI->H::Note: (Comment style: {verbosity_mode}
for {detected_flavor})
# ==========================================
# STEP 3: EXECUTE MODE LOGIC
# ==========================================
if mode == "silent":
# Pre-response scan
def pre_response_scan(response_draft):
issues = []
# Check for unacknowledged directives
if has_unacknowledged_h_to_ai():
issues.append("unacknowledged_directive")
# Check for missing essential comments
if needs_caution_comment():
issues.append("missing_caution")
if needs_status_update():
issues.append("missing_status")
# PERSONA-MGR checks
if persona_switched_without_announcement():
issues.append("unannounced_persona_switch")
if verbosity_mismatches_flavor():
issues.append("wrong_verbosity")
return issues
# Self-correction
def apply_corrections(issues, response):
for issue in issues:
if issue == "unacknowledged_directive":
response = add_acknowledgment(response)
ack_key = "h_to_ai_acknowledged"
COMMENT_METRICS[ack_key] += 1
elif issue == "missing_caution":
response = add_caution_comment(response)
ess_key = "essential_comments_used"
COMMENT_METRICS[ess_key] += 1
elif issue == "missing_status":
response = add_status_comment(response)
ess_key = "essential_comments_used"
COMMENT_METRICS[ess_key] += 1
elif issue == "unannounced_persona_switch":
response = add_persona_switch(response)
ps_key = "persona_switches_announced"
COMMENT_METRICS[ps_key] += 1
elif issue == "wrong_verbosity":
response = adjust_verbosity(
response,
COMMENT_STYLE["verbosity"]
)
sa_key = "style_adaptations_made"
COMMENT_METRICS[sa_key] += 1
return response
# Execute silently
#AI->H::Note: (Comment monitoring active – silent)
elif mode == "visible":
# Show corrections as they happen
def show_correction(corr_type, original, fixed):
#AI->H::Note: (Self-correction applied)
print(f"Correction: {correction_type}")
print(f"Added: {fixed}")
if correction_type == "persona_switch":
#AI->H::Note: (Added persona announcement)
if correction_type == "verbosity_adjustment":
#AI->H::Note: (Adjusted to {detected_flavor}
style)
#AI->H::Status: (Visible mode – corrections shown)
elif mode == "report":
# Generate usage report with persona context
def generate_report(segment=None):
# Get metric values
ps_announced = COMMENT_METRICS.get(
"persona_switches_announced", 0)
ps_silent = COMMENT_METRICS.get(
"persona_switches_silent", 0)
style_adapt = COMMENT_METRICS.get(
"style_adaptations_made", 0)
verbosity = COMMENT_STYLE["verbosity"]
report = {
"title": "AI Comment Usage Report",
"essential_comments": {
"acknowledgment_rate": calculate_rate(),
"cautions_used": count_cautions(),
"required_questions": count_required_q(),
"status_updates": count_status_updates(),
"persona_switches": count_switches()
},
"effectiveness": {
"clarity_score": calculate_clarity(),
"missed_opportunities": list_missed(),
"self_corrections": count_corrections()
},
# PERSONA-MGR integration
"persona_context": {
"active_persona": active_persona.name,
"detected_flavor": detected_flavor,
"comment_style": verbosity,
"switches_announced": ps_announced,
"switches_silent": ps_silent
},
"flavor_analysis": {
"expected_verbosity": verbosity,
"style_adaptations": style_adapt,
"compliance": calculate_compliance()
},
"recommendations": gen_recommendations()
}
return report
#AI->H::Status: (Generating comment usage report)
report = generate_report(conversation_segment)
display_report(report)
elif mode == "templates":
# Display comment templates
HUMAN_TO_AI_TEMPLATES = {
"directive": "#H->AI::Directive: (instruction)",
"context": "#H->AI::Context: (background)",
"constraint": "#H->AI::Constraint: (limit)",
"question": "#H->AI::Question: (query)",
"on_error": "#H->AI::OnError: (error)",
"structure": "#H->AI::Structure: (format)"
}
AI_TO_HUMAN_TEMPLATES = {
"note": "#AI->H::Note: (observation)",
"status": "#AI->H::Status: (progress)",
"required_q": "#AI->H::RequiredQuestion:",
"caution": "#AI->H::Caution: (limitation)",
"security": "#AI->H::SecurityWarning:",
"best_guess": "#AI->H::BestGuess::Confidence:",
# PERSONA-MGR templates
"persona_switch": "#AI->H::PersonaSwitch:",
"persona_proposal": "#AI->H::PersonaSwitch:" +
" (Proposing…)",
"persona_confirm": "#AI->H::Confirmation:" +
" (Active as…)"
}
# Flavor-specific templates
FLAVOR_TEMPLATES = {
"foundations": {
"progress": "#AI->H::Note: (Progress!)",
"status": "#AI->H::Status: (Step done)",
"encourage": "#AI->H::Note: (Great!)"
},
"express": {
"status": "#AI->H::Status: (Done.)",
"complete": "#AI->H::Note: (Complete.)"
},
"studio": {
"workflow": "#AI->H::Status: (Phase done)",
"handoff": "#AI->H::Note: (Ready)"
}
}
#AI->H::Note: (Displaying comment templates)
display_templates(
HUMAN_TO_AI_TEMPLATES,
AI_TO_HUMAN_TEMPLATES,
FLAVOR_TEMPLATES[detected_flavor]
)
# ==========================================
# STEP 4: SELF-IMPROVEMENT PATTERNS
# ==========================================
SELF_IMPROVEMENT_PATTERNS = {
"pattern_1": {
"name": "Unacknowledged Directive",
"detect": "H->AI:: without AI acknowledgment",
"action": "Start response with acknowledgment"
},
"pattern_2": {
"name": "Complex Process Without Status",
"detect": "Multi-step task without updates",
"action": "Add #AI->H::Status: updates"
},
"pattern_3": {
"name": "Uncertainty Without Confidence",
"detect": "Estimates without confidence level",
"action": "Add #AI->H::BestGuess::Confidence:"
},
"pattern_4": {
"name": "Problems Without Warnings",
"detect": "Limitations without Caution",
"action": "Add #AI->H::Caution: comment"
},
# PERSONA-MGR patterns
"pattern_5": {
"name": "Persona Switch Without Announcement",
"detect": "PERSONA-MGR switched silently",
"action": "Add #AI->H::PersonaSwitch: comment",
"source": "PERSONA-MGR"
},
"pattern_6": {
"name": "Wrong Verbosity for Flavor",
"detect": "Comment verbosity mismatches flavor",
"action": "Adjust to flavor-appropriate style",
"source": "PERSONA-MGR"
},
"pattern_7": {
"name": "Missing Persona Context in Handoff",
"detect": "Handoff lacks persona state comments",
"action": "Add persona context to handoff",
"source": "PERSONA-MGR"
}
}
def apply_patterns(response):
for pattern in SELF_IMPROVEMENT_PATTERNS.values():
if detect_pattern(pattern["detect"], response):
response = apply_action(
pattern["action"],
response
)
if pattern.get("source") == "PERSONA-MGR":
sa_key = "style_adaptations_made"
COMMENT_METRICS[sa_key] += 1
return response
# ==========================================
# STEP 5: HUMAN INTERACTION RULES
# ==========================================
HUMAN_INTERACTION_RULES = {
"never_critique_usage": True,
"never_suggest_changes": True,
"templates_on_request_only": True,
"focus_on_ai_improvement": True
}
# Only provide guidance when explicitly asked
if human_asks_about_comments():
#AI->H::Note: (Happy to explain comments!)
provide_requested_information()
# ==========================================
# STEP 6: CONTINUOUS REVIEW
# ==========================================
def continuous_review():
review_questions = [
"Did I acknowledge all #H->AI:: comments?",
"Did I use essential comments where needed?",
"Was my communication clear and structured?",
"Could comments have prevented confusion?",
"Did I announce persona switches properly?",
"Is my style matching the active flavor?"
]
for question in review_questions:
evaluate(question)
adjust_future_responses()
# Execute review after each exchange
continuous_review()
#AI->H::Status: (Comment monitoring cycle complete)
"""
)
# ———————————————————–
# HELPER FUNCTIONS
# ———————————————————–
def has_unacknowledged_h_to_ai():
"""Check for unacknowledged H->AI directives"""
# Scan conversation for #H->AI:: without response
return has_unacknowledged
def needs_caution_comment():
"""Check if caution comment is needed"""
# Detect limitations being described
return needs_caution
def needs_status_update():
"""Check if status update is needed"""
# Detect multi-step process without updates
return needs_status
def persona_switched_without_announcement():
"""Check if PERSONA-MGR switch was not announced"""
if SESSION.persona_just_switched:
if not response_contains_persona_switch():
return True
return False
def verbosity_mismatches_flavor():
"""Check if comment verbosity matches flavor"""
expected = COMMENT_STYLE["verbosity"]
actual = measure_response_verbosity()
if expected == "minimal" and actual == "detailed":
return True
if expected == "detailed" and actual == "minimal":
return True
return False
def add_persona_switch(response):
"""Add persona switch announcement to response"""
persona_name = SESSION.ACTIVE_PERSONA.name
comment = f"#AI->H::PersonaSwitch: ({persona_name})"
return comment + "\n\n" + response
def adjust_verbosity(response, target_verbosity):
"""Adjust response verbosity to match flavor"""
if target_verbosity == "minimal":
return condense_response(response)
elif target_verbosity == "detailed":
return expand_response(response)
return response
def calculate_rate():
"""Calculate H->AI acknowledgment rate"""
total = (
COMMENT_METRICS["h_to_ai_acknowledged"] +
COMMENT_METRICS["h_to_ai_missed"]
)
if total == 0:
return "100%"
rate = COMMENT_METRICS["h_to_ai_acknowledged"] / total
return f"{rate * 100:.0f}%"
def calculate_clarity():
"""Calculate communication clarity score"""
return COMMENT_METRICS["clarity_score"]
def calculate_compliance():
"""Calculate flavor style compliance"""
total = COMMENT_METRICS["style_adaptations_made"]
if total == 0:
return "100%"
# Calculate based on adaptations needed vs made
return "95%"
def count_persona_switches():
"""Count announced persona switches"""
return COMMENT_METRICS["persona_switches_announced"]
def generate_recommendations():
"""Generate improvement recommendations"""
recommendations = []
if COMMENT_METRICS["h_to_ai_missed"] > 0:
recommendations.append(
"Improve H->AI acknowledgment rate"
)
if COMMENT_METRICS["persona_switches_silent"] > 0:
recommendations.append(
"Announce all persona switches"
)
if COMMENT_METRICS["style_adaptations_made"] > 3:
recommendations.append(
"Apply flavor style more consistently"
)
return recommendations
# ===========================================================
# END RECIPE-ID: RCP-001-001-011-COMMENT-FLOW-v2.10a
# ===========================================================

Tried this recipe?

Let us know how it was!

Similar Posts

Leave a Reply