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/remove_context.py

View on GitHub
#!/usr/bin/env python3
"""Safely remove a RecallLoom workspace from a project."""

from __future__ import annotations

import argparse
import json
import shutil
from pathlib import Path

from core.bridge.blocks import (
    bridge_block_integrity,
)
from core.protocol.contracts import BRIDGE_START, ROOT_ENTRY_CANDIDATES

from _common import (
    cli_failure_payload,
    cli_failure_payload_for_exception,
    ConfigContractError,
    EnvironmentContractError,
    enforce_package_support_gate,
    exit_with_cli_error,
    find_recovery_workspace,
    LockBusyError,
    read_text,
    StorageResolutionError,
    ensure_supported_python_version,
    find_recallloom_root,
    public_json_payload,
    remove_git_exclude_block,
    unknown_storage_assets,
    validate_storage_mode,
    workspace_write_lock,
)


def build_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(
        description="Safely remove a RecallLoom workspace from a project."
    )
    parser.add_argument(
        "path",
        nargs="?",
        default=".",
        help="Project path or a descendant path. Defaults to the current working directory.",
    )
    parser.add_argument(
        "--yes",
        action="store_true",
        help="Perform the removal. Without this flag, the script only reports what would be removed.",
    )
    parser.add_argument(
        "--force",
        action="store_true",
        help="Allow removal even if the storage root contains non-managed files or directories.",
    )
    parser.add_argument(
        "--storage-mode",
        choices=["hidden", "visible"],
        help="Recovery-only hint for choosing which sidecar to remove when normal workspace detection fails or both sidecars exist.",
    )
    parser.add_argument(
        "--json",
        action="store_true",
        help="Print structured JSON output.",
    )
    return parser


def unique_tombstone_path(project_root: Path, storage_root_name: str) -> Path:
    base = project_root / f".recallloom-delete-{storage_root_name}"
    if not base.exists():
        return base
    counter = 1
    while True:
        candidate = project_root / f".recallloom-delete-{storage_root_name}-{counter}"
        if not candidate.exists():
            return candidate
        counter += 1


def managed_bridge_targets(project_root: Path) -> tuple[list[str], list[str]]:
    healthy_targets: list[str] = []
    malformed_targets: list[str] = []
    for rel_path in ROOT_ENTRY_CANDIDATES:
        path = project_root / rel_path
        if not path.is_file():
            continue
        text = read_text(path)
        ok, reason = bridge_block_integrity(text)
        has_bridge_block = BRIDGE_START in text
        if not ok:
            malformed_targets.append(f"{path} ({reason or 'bridge_malformed'})")
            continue
        if has_bridge_block:
            healthy_targets.append(str(path))
    return healthy_targets, malformed_targets

def main() -> None:
    parser = build_parser()
    args = parser.parse_args()
    try:
        ensure_supported_python_version()
    except EnvironmentContractError as exc:
        exit_with_cli_error(
            parser,
            json_mode=args.json,
            exit_code=2,
            message=str(exc),
            payload=cli_failure_payload("python_runtime_unavailable", error=str(exc)),
        )
    enforce_package_support_gate(parser, json_mode=args.json)

    requested_storage_mode = validate_storage_mode(args.storage_mode) if args.storage_mode else None
    try:
        workspace = find_recallloom_root(
            args.path,
            allow_unsupported_version=True,
            allow_storage_mode_mismatch=True,
        )
    except (StorageResolutionError, ConfigContractError):
        workspace = None
    if workspace is None:
        try:
            workspace = find_recovery_workspace(
                args.path,
                requested_storage_mode=requested_storage_mode,
            )
        except StorageResolutionError as exc:
            exit_with_cli_error(
                parser,
                json_mode=args.json,
                exit_code=2,
                message=str(exc),
                payload=cli_failure_payload_for_exception(exc, default_reason="damaged_sidecar"),
            )
    if workspace is None:
        exit_with_cli_error(
            parser,
            json_mode=args.json,
            exit_code=1,
            message="No RecallLoom project root found.",
            payload=cli_failure_payload("no_project_root", error="No RecallLoom project root found."),
        )

    try:
        with workspace_write_lock(workspace.project_root, "remove_context.py"):
            storage_root = workspace.storage_root
            if storage_root == workspace.project_root:
                message = "Refusing to remove RecallLoom because storage_root resolves to the project root."
                exit_with_cli_error(
                    parser,
                    json_mode=args.json,
                    exit_code=2,
                    message=message,
                    payload=cli_failure_payload("invalid_storage_boundary", error=message),
                )

            if storage_root.parent != workspace.project_root:
                message = "Refusing to remove RecallLoom because storage_root is not a direct child of the project root."
                exit_with_cli_error(
                    parser,
                    json_mode=args.json,
                    exit_code=2,
                    message=message,
                    payload=cli_failure_payload("invalid_storage_boundary", error=message),
                )

            if storage_root.name not in {".recallloom", "recallloom"}:
                message = f"Refusing to remove unexpected storage root: {storage_root}"
                exit_with_cli_error(
                    parser,
                    json_mode=args.json,
                    exit_code=2,
                    message=message,
                    payload=cli_failure_payload("invalid_storage_boundary", error=message),
                )

            removed_storage = False
            storage_relocated = False
            removed_git_exclude_block = False
            tombstone_path = None
            storage_cleanup_error = None
            exclude_cleanup_error = None
            unknown_assets = [str(path) for path in unknown_storage_assets(storage_root)]
            bridge_targets, malformed_bridge_targets = managed_bridge_targets(workspace.project_root)

            if bridge_targets or malformed_bridge_targets:
                detail_lines = []
                if bridge_targets:
                    detail_lines.append("Managed bridge blocks still exist in:")
                    detail_lines.extend(bridge_targets)
                if malformed_bridge_targets:
                    detail_lines.append("Malformed bridge blocks still exist in:")
                    detail_lines.extend(malformed_bridge_targets)
                detail_lines.append(
                    "Remove or repair bridge blocks before removing the RecallLoom sidecar. "
                    "In v1 uninstall remains a two-step flow: remove bridge first, then remove the sidecar."
                )
                exit_with_cli_error(
                    parser,
                    json_mode=args.json,
                    exit_code=3,
                    message="\n".join(detail_lines),
                    payload=cli_failure_payload(
                        "malformed_managed_file" if malformed_bridge_targets else "invalid_prepared_input",
                        error="\n".join(detail_lines),
                        details={
                            "bridge_targets": bridge_targets,
                            "malformed_bridge_targets": malformed_bridge_targets,
                        },
                    ),
                )

            if args.yes and unknown_assets and not args.force:
                message = (
                    "Refusing to remove RecallLoom because the storage root contains non-managed assets. "
                    "Review the reported paths or re-run with --force."
                )
                exit_with_cli_error(
                    parser,
                    json_mode=args.json,
                    exit_code=3,
                    message=message,
                    payload=cli_failure_payload(
                        "invalid_prepared_input",
                        error=message,
                        details={"unknown_assets": unknown_assets},
                    ),
                )

            if args.yes:
                if workspace.storage_mode == "hidden":
                    try:
                        removed_git_exclude_block = remove_git_exclude_block(workspace.project_root)
                    except ConfigContractError as exc:
                        exit_with_cli_error(
                            parser,
                            json_mode=args.json,
                            exit_code=2,
                            message=str(exc),
                            payload=cli_failure_payload_for_exception(exc, default_reason="malformed_managed_file"),
                        )
                    except LockBusyError as exc:
                        exit_with_cli_error(
                            parser,
                            json_mode=args.json,
                            exit_code=3,
                            message=str(exc),
                            payload=cli_failure_payload("write_lock_busy", error=str(exc)),
                        )
                    except OSError as exc:
                        message = f"Filesystem error: {exc}"
                        exit_with_cli_error(
                            parser,
                            json_mode=args.json,
                            exit_code=2,
                            message=message,
                            payload=cli_failure_payload("damaged_sidecar", error=message),
                        )

                tombstone = unique_tombstone_path(workspace.project_root, storage_root.name)
                storage_root.rename(tombstone)
                tombstone_path = str(tombstone)
                try:
                    if tombstone.is_dir():
                        shutil.rmtree(tombstone)
                    else:
                        tombstone.unlink()
                    removed_storage = True
                    storage_relocated = False
                    tombstone_path = None
                except OSError as exc:
                    storage_relocated = True
                    storage_cleanup_error = (
                        f"Sidecar was moved to {tombstone}, but cleanup of the tombstone failed: {exc}"
                    )

            payload = {
                "project_root": str(workspace.project_root),
                "storage_root": str(storage_root),
                "storage_mode": workspace.storage_mode,
                "dry_run": not args.yes,
                "force": args.force,
                "unknown_asset_count": len(unknown_assets),
                "unknown_assets": unknown_assets,
                "removed_storage": removed_storage,
                "storage_relocated": storage_relocated,
                "tombstone_path": tombstone_path,
                "storage_cleanup_error": storage_cleanup_error,
                "removed_git_exclude_block": removed_git_exclude_block,
                "exclude_cleanup_error": exclude_cleanup_error,
            }
            if storage_cleanup_error:
                exit_with_cli_error(
                    parser,
                    json_mode=args.json,
                    exit_code=2,
                    message=storage_cleanup_error,
                    payload=cli_failure_payload(
                        "storage_cleanup_incomplete",
                        error=storage_cleanup_error,
                        details=payload,
                        extra=payload,
                    ),
                )
    except LockBusyError as exc:
        exit_with_cli_error(
            parser,
            json_mode=args.json,
            exit_code=3,
            message=str(exc),
            payload=cli_failure_payload("write_lock_busy", error=str(exc)),
        )
    except (OSError, UnicodeDecodeError) as exc:
        message = f"Filesystem error: {exc}"
        exit_with_cli_error(
            parser,
            json_mode=args.json,
            exit_code=2,
            message=message,
            payload=cli_failure_payload("damaged_sidecar", error=message),
        )

    if args.json:
        print(
            json.dumps(
                public_json_payload(payload, project_root=workspace.project_root),
                ensure_ascii=False,
                indent=2,
            )
        )
    else:
        if args.yes:
            if removed_storage:
                print(f"Removed RecallLoom storage root: {storage_root}")
            elif storage_relocated:
                print(
                    "RecallLoom storage root was moved out of the project, but final cleanup is incomplete: "
                    f"{tombstone_path}"
                )
            if workspace.storage_mode == "hidden":
                print(
                    "Removed RecallLoom git exclude block: "
                    f"{'yes' if removed_git_exclude_block else 'no'}"
                )
            if storage_cleanup_error:
                print(f"Warning: {storage_cleanup_error}")
            if exclude_cleanup_error:
                print(f"Warning: {exclude_cleanup_error}")
        else:
            print("Dry run only. Use --yes to remove.")
            print(f"Would remove storage root: {storage_root}")
            if unknown_assets:
                print("Unknown assets detected inside the storage root:")
                for item in unknown_assets:
                    print(f"  - {item}")
                print("Re-run with --yes --force only if you intentionally want to remove them too.")
            if workspace.storage_mode == "hidden":
                print("Would also remove the RecallLoom block from .git/info/exclude if present.")


if __name__ == "__main__":
    main()
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