Skip to content

Frappucc1no/recall-loom / skills/recallloom

recallloom

Flagged

Use when a task involves continuing a project, restoring project context, maintaining file-based project memory, updating current-state summaries, or recording meaningful progress across sessions. Works best for long-horizon, file-based projects and supports research writing, product document collaboration, software project coordination, and broader cross-functional project continuity.

FileKindSize
LICENSEother10.0 KB
NOTICEother190 B
SKILL.mdskill md24.5 KB
managed-assets.jsonconfig1.1 KB
native_commands/README.mdmarkdown1.2 KB
native_commands/claude-code/rl-init.md.tmplother323 B
native_commands/claude-code/rl-resume.md.tmplother290 B
native_commands/claude-code/rl-status.md.tmplother299 B
native_commands/claude-code/rl-validate.md.tmplother277 B
native_commands/gemini-cli/rl-init.toml.tmplother295 B
native_commands/gemini-cli/rl-resume.toml.tmplother262 B
native_commands/gemini-cli/rl-status.toml.tmplother271 B
native_commands/gemini-cli/rl-validate.toml.tmplother249 B
native_commands/opencode/rl-init.md.tmplother286 B
native_commands/opencode/rl-resume.md.tmplother253 B
native_commands/opencode/rl-status.md.tmplother262 B
native_commands/opencode/rl-validate.md.tmplother240 B
package-metadata.jsonconfig1.0 KB
profiles/general-project-continuity.mdmarkdown2.4 KB
profiles/product-doc-collaboration.mdmarkdown2.2 KB
profiles/research-writing.mdmarkdown2.1 KB
profiles/software-project-coordination.mdmarkdown2.8 KB
references/anti-patterns.mdmarkdown2.5 KB
references/contract-registry.jsonconfig7.7 KB
references/contract-schema.jsonconfig7.7 KB
references/file-contracts.mdmarkdown23.4 KB
references/operation-playbooks.mdmarkdown26.5 KB
references/package-support-policy.mdmarkdown9.4 KB
references/profiles.mdmarkdown2.0 KB
references/protocol.mdmarkdown20.5 KB
references/recording-workflow.mdmarkdown9.9 KB
scripts/_common.pyscript87.8 KB
scripts/append_daily_log_entry.pyscript40.4 KB
scripts/archive_logs.pyscript17.6 KB
scripts/commit_context_file.pyscript31.6 KB
scripts/core/__init__.pyscript39 B
scripts/core/bridge/__init__.pyscript30 B
scripts/core/bridge/blocks.pyscript6.9 KB
scripts/core/coldstart/__init__.pyscript26 B
scripts/core/coldstart/sources.pyscript22.4 KB
scripts/core/coldstart/structured.pyscript5.4 KB
scripts/core/continuity/__init__.pyscript34 B
scripts/core/continuity/daily_log.pyscript16.1 KB
scripts/core/continuity/freshness.pyscript15.3 KB
scripts/core/continuity/preflight.pyscript41.0 KB
scripts/core/continuity/quick_summary.pyscript10.9 KB
scripts/core/continuity/workday.pyscript12.3 KB
scripts/core/errors.pyscript838 B
scripts/core/failure/__init__.pyscript47 B
scripts/core/failure/context.pyscript5.6 KB
scripts/core/failure/contracts.pyscript108.6 KB
scripts/core/output/__init__.pyscript35 B
scripts/core/output/confirmation_material.pyscript15.0 KB
scripts/core/output/privacy.pyscript10.5 KB
scripts/core/output/user_status.pyscript5.8 KB
scripts/core/protocol/__init__.pyscript60 B
scripts/core/protocol/contracts.pyscript8.3 KB
scripts/core/protocol/markers.pyscript4.9 KB
scripts/core/protocol/sections.pyscript3.4 KB
scripts/core/protocol/templates.pyscript6.5 KB
scripts/core/provenance/__init__.pyscript67 B
scripts/core/provenance/bindings.pyscript13.2 KB
scripts/core/provenance/evidence.pyscript58.2 KB
scripts/core/provenance/inconsistent_review.pyscript85.6 KB
scripts/core/provenance/receipts.pyscript20.2 KB
scripts/core/provenance/state.pyscript38.0 KB
scripts/core/provenance/store.pyscript43.8 KB
scripts/core/recording/__init__.pyscript1.6 KB
scripts/core/recording/contracts.pyscript31.7 KB
scripts/core/recording/daily_log_append.pyscript30.2 KB
scripts/core/recording/managed_write.pyscript52.8 KB
scripts/core/recording/planner.pyscript20.6 KB
scripts/core/recording/privacy.pyscript1.7 KB
scripts/core/recording/suggestions.pyscript8.6 KB
scripts/core/recording/transaction.pyscript93.3 KB
scripts/core/registry/__init__.pyscript58 B
scripts/core/registry/loader.pyscript18.8 KB
scripts/core/safety/__init__.pyscript30 B
scripts/core/safety/attached_text.pyscript6.9 KB
scripts/core/safety/input_transport.pyscript61.0 KB
scripts/core/safety/prepared_input.pyscript24.4 KB
scripts/core/safety/scratch_residue.pyscript18.8 KB
scripts/core/support/__init__.pyscript53 B
scripts/core/support/cache.pyscript19.4 KB
scripts/core/support/policy.pyscript8.8 KB
scripts/core/trust/__init__.pyscript42 B
scripts/core/trust/state.pyscript4.1 KB
scripts/core/workspace/__init__.pyscript33 B
scripts/core/workspace/atomic_io.pyscript12.2 KB
scripts/core/workspace/runtime.pyscript54.7 KB
scripts/detect_project_root.pyscript3.4 KB
scripts/generate_coldstart_proposal.pyscript7.5 KB
scripts/init_context.pyscript37.8 KB
scripts/install_native_commands.pyscript31.5 KB
scripts/manage_entry_bridge.pyscript20.8 KB
scripts/preflight_context_check.pyscript10.1 KB
scripts/prepare_recovery_promotion.pyscript22.1 KB
scripts/query_continuity.pyscript84.1 KB
scripts/recallloom.pyscript233.7 KB
scripts/recommend_workday.pyscript17.6 KB
scripts/record_recovery_review.pyscript50.9 KB
scripts/remove_context.pyscript13.9 KB
scripts/repair_daily_log_cursor.pyscript33.7 KB
scripts/stage_recovery_proposal.pyscript17.5 KB
scripts/summarize_continuity_status.pyscript43.7 KB
scripts/sync_contract_docs.pyscript11.3 KB
scripts/unlock_write_lock.pyscript8.1 KB
scripts/validate_context.pyscript54.9 KB

scripts/core/bridge/blocks.py

View on GitHub
#!/usr/bin/env python3
"""Bridge block rendering and integrity helpers."""

from __future__ import annotations

import os
from pathlib import Path
import re

from core.protocol.contracts import (
    BRIDGE_END,
    BRIDGE_START,
    DAILY_LOGS_DIRNAME,
    EXCLUDE_BLOCK_END,
    EXCLUDE_BLOCK_START,
    FILE_KEYS,
    ROOT_ENTRY_CANDIDATES,
)


def bridge_block_integrity(text: str) -> tuple[bool, str | None]:
    start_count = text.count(BRIDGE_START)
    end_count = text.count(BRIDGE_END)
    if start_count == 0 and end_count == 0:
        return True, None
    if start_count != end_count:
        return False, "bridge_start_end_mismatch"
    if start_count > 1:
        return False, "bridge_duplicate_blocks"
    if text.find(BRIDGE_START) > text.find(BRIDGE_END):
        return False, "bridge_order_invalid"
    return True, None


def _exact_marker_line_indices(text: str, marker: str) -> list[int]:
    return [idx for idx, line in enumerate(text.splitlines()) if line == marker]


def exclude_block_integrity(text: str) -> tuple[bool, str | None]:
    start_indices = _exact_marker_line_indices(text, EXCLUDE_BLOCK_START)
    end_indices = _exact_marker_line_indices(text, EXCLUDE_BLOCK_END)
    start_count = len(start_indices)
    end_count = len(end_indices)
    if text.count(EXCLUDE_BLOCK_START) != start_count or text.count(EXCLUDE_BLOCK_END) != end_count:
        return False, "exclude_marker_line_invalid"
    if start_count == 0 and end_count == 0:
        return True, None
    if start_count != end_count:
        return False, "exclude_start_end_mismatch"
    if start_count > 1:
        return False, "exclude_duplicate_blocks"
    if start_indices[0] > end_indices[0]:
        return False, "exclude_order_invalid"
    return True, None


def managed_exclude_block_text(text: str) -> str | None:
    lines = text.splitlines()
    start_indices = [idx for idx, line in enumerate(lines) if line == EXCLUDE_BLOCK_START]
    end_indices = [idx for idx, line in enumerate(lines) if line == EXCLUDE_BLOCK_END]
    if not start_indices and not end_indices:
        return None
    if len(start_indices) != 1 or len(end_indices) != 1 or start_indices[0] > end_indices[0]:
        return None
    return "\n".join(lines[start_indices[0] : end_indices[0] + 1])


def _to_posix_relative(from_dir: Path, to_path: Path) -> str:
    return Path(os.path.relpath(to_path, start=from_dir)).as_posix()


def detect_root_entry_files(project_root: Path) -> list[Path]:
    found: list[Path] = []
    for rel_path in ROOT_ENTRY_CANDIDATES:
        candidate = project_root / rel_path
        if candidate.is_file():
            found.append(candidate)
    return found


def render_bridge_block(workspace, target_file: Path) -> str:
    target_dir = target_file.parent
    language = workspace.workspace_language
    config = _to_posix_relative(target_dir, workspace.storage_root / FILE_KEYS["config"])
    update_protocol = _to_posix_relative(target_dir, workspace.storage_root / FILE_KEYS["update_protocol"])
    context_brief = _to_posix_relative(target_dir, workspace.storage_root / FILE_KEYS["context_brief"])
    rolling_summary = _to_posix_relative(target_dir, workspace.storage_root / FILE_KEYS["rolling_summary"])
    daily_logs_dir = _to_posix_relative(target_dir, workspace.storage_root / DAILY_LOGS_DIRNAME)
    has_update_protocol = (workspace.storage_root / FILE_KEYS["update_protocol"]).is_file()

    if language == "zh-CN":
        body = [
            BRIDGE_START,
            "本项目使用 RecallLoom 管理持久化项目连续性上下文。",
            "",
            "需要恢复项目连续性时,请优先读取:",
            f"- {config}",
        ]
        if has_update_protocol:
            body.append(f"- {update_protocol}(先人工查看其中的项目级约束与补充说明)")
        body.extend(
            [
                f"- {context_brief}",
                f"- {rolling_summary}",
                f"- {daily_logs_dir}/(如存在 active 日志,则读取其中最新的一份 active daily log)",
                "",
                "平台入口文档负责工具行为规则;RecallLoom 负责项目连续性状态。",
                "如果存在 update_protocol.md,请先人工查看其中的项目级约束与补充说明;v1 helper 不会自动解析其中的自然语言内容。",
                "不要随意覆盖这些文件。",
                BRIDGE_END,
            ]
        )
    else:
        body = [
            BRIDGE_START,
            "This project uses RecallLoom for persistent project continuity.",
            "",
            "For continuity state, read:",
            f"- {config}",
        ]
        if has_update_protocol:
            body.append(f"- {update_protocol} (review project-local constraints and notes first)")
        body.extend(
            [
                f"- {context_brief}",
                f"- {rolling_summary}",
                f"- the latest active daily log under {daily_logs_dir}/ if one exists",
                "",
                "Platform entry files define tool behavior; RecallLoom defines project continuity state.",
                "If update_protocol.md exists, review its project-local constraints and notes first; v1 helpers do not parse natural-language override prose automatically.",
                "Do not overwrite these files casually.",
                BRIDGE_END,
            ]
        )
    return "\n".join(body)


def replace_or_insert_bridge(text: str, block: str) -> str:
    if BRIDGE_START in text and BRIDGE_END in text:
        pattern = re.compile(
            re.escape(BRIDGE_START) + r".*?" + re.escape(BRIDGE_END),
            flags=re.S,
        )
        updated = pattern.sub(block, text, count=1)
        return updated if updated.endswith("\n") else updated + "\n"

    lines = text.splitlines()
    if lines and lines[0].strip() == "---":
        try:
            end_idx = next(i for i, line in enumerate(lines[1:], start=1) if line.strip() == "---")
        except StopIteration:
            end_idx = -1
        if end_idx != -1:
            head = "\n".join(lines[: end_idx + 1]).rstrip("\n")
            tail = "\n".join(lines[end_idx + 1 :]).lstrip("\n")
            pieces = [head, "", block]
            if tail:
                pieces.extend(["", tail])
            result = "\n".join(pieces)
            return result if result.endswith("\n") else result + "\n"

    stripped = text.rstrip("\n")
    if stripped:
        result = stripped + "\n\n" + block + "\n"
    else:
        result = block + "\n"
    return result


def remove_bridge_block(text: str) -> tuple[str, bool]:
    if BRIDGE_START not in text or BRIDGE_END not in text:
        return text, False
    pattern = re.compile(
        r"\n*" + re.escape(BRIDGE_START) + r".*?" + re.escape(BRIDGE_END) + r"\n*",
        flags=re.S,
    )
    updated = pattern.sub("\n\n", text, count=1)
    updated = re.sub(r"\n{3,}", "\n\n", updated).strip("\n")
    return ((updated + "\n") if updated else ""), True
add-product-e2e-evalpaperclipai/paperclipAdd or extend a Paperclip full-stack runner E2E workflow, fixture, matcher, or report evidence path for local or Daytona execution.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
add-runner-evalpaperclipai/paperclipAdd or extend a Paperclip Runner protocol evaluation definition, roster, assertion, or report fixture with provenance and narrow validation.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
diagnose-why-work-stoppedpaperclipai/paperclipCompatibility entry point for failed, stalled, looping, or over-recovered Paperclip work. Use fix-failed-paperclip-run for the full diagnosis, regression, repair, real verification, and green-PR workflow; honor an explicitly requested diagnosis-only scope.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
fix-failed-paperclip-runpaperclipai/paperclipDiagnose and fix failed, stuck, slow, or incorrectly blocked Paperclip tasks and runs. Use with a task/run URL or failure report to trace the root cause, prove a regression red then green, check second-order effects, verify the real workflow, and deliver a PR with passing checks.Stars: 115kUpdated Claude CodeCodexVerifiedInstall