Skip to content

feat: ADR-007 Memory-First Architecture enforcement and Forgetful MCP setup#730

Merged
rjmurillo merged 25 commits into
mainfrom
feat/memory
Jan 1, 2026
Merged

feat: ADR-007 Memory-First Architecture enforcement and Forgetful MCP setup#730
rjmurillo merged 25 commits into
mainfrom
feat/memory

Conversation

@rjmurillo-bot

Copy link
Copy Markdown
Collaborator

Summary

Implements ADR-007 Memory-First Architecture enforcement mechanisms and comprehensive Forgetful MCP server setup infrastructure. This PR establishes automated validation to ensure memory retrieval precedes reasoning in all agent sessions.

Specification References

Type Reference Description
ADR .agents/architecture/ADR-007-memory-first-architecture.md Memory-First Architecture decision
Analysis .agents/analysis/ADR-007-enforcement-gap-analysis.md Enforcement gap identification
Debate .agents/critique/ADR-007-debate-log.md Multi-agent ADR review (6/6 consensus)

Changes

Enforcement Mechanisms

  • E2 Enhanced Session Validation: Test-MemoryEvidence function validates Evidence column contains actual memory names
  • E4 Pre-commit Warning: Pattern matching for memory evidence in session logs
  • SessionStart Hook: MCP availability check with fallback guidance
  • UserPromptSubmit Hook: Memory-first compliance reminder

Forgetful MCP Setup Infrastructure

  • scripts/forgetful/README.md - Comprehensive setup documentation
  • scripts/forgetful/Install-ForgetfulLinux.ps1 - systemd user service installation
  • scripts/forgetful/Install-ForgetfulWindows.ps1 - Windows scheduled task installation
  • scripts/forgetful/Test-ForgetfulHealth.ps1 - Health check with TCP and service status

ADR-007 Enhancements

  • Added Fallback Behavior section for when Forgetful is unavailable
  • Fixed memory workflow to Serena-first (was incorrectly Forgetful-first)
  • Documented tool selection rationale

adr-review Skill Enhancements

  • Issue Resolution Protocol for P0/P1/P2 handling
  • P1 deferral tracking via GitHub issues with adr-followup label
  • Keyword-based surfacing mechanism for amnesiac agents

CI/CD Updates

  • Updated copilot-setup-steps.yml to use PowerShell and TCP port check
  • Fixed invalid /health endpoint (MCP requires session init)

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update
  • Infrastructure/CI change
  • Refactoring (no functional changes)

Testing

  • Tests added/updated
  • Manual testing completed
  • No testing required (documentation only)

Test Coverage:

  • tests/Test-MemoryEvidence.Tests.ps1 - 12 tests for E2 validation
  • tests/Invoke-SessionStartMemoryFirst.Tests.ps1 - 8 tests for SessionStart hook
  • tests/Invoke-UserPromptMemoryCheck.Tests.ps1 - 14 tests for UserPromptSubmit hook
  • All 34 Pester tests passing

Agent Review

Security Review

Required for: Authentication, authorization, CI/CD, git hooks, secrets, infrastructure

  • No security-critical changes in this PR
  • Security agent reviewed infrastructure changes
  • Security agent reviewed authentication/authorization changes
  • Security patterns applied (see .agents/security/)

Files requiring security review:

  • .github/workflows/copilot-setup-steps.yml - Forgetful server startup
  • .githooks/pre-commit - Memory evidence warning
  • .claude/hooks/*.ps1 - Memory-first enforcement hooks

Other Agent Reviews

  • Architect reviewed design changes
  • Critic validated implementation plan
  • QA verified test coverage

Multi-agent ADR Review:

  • 6/6 agents reached consensus (Accept) in Round 1
  • Debate log: .agents/critique/ADR-007-debate-log.md

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated (if applicable)
  • No new warnings introduced

Related Issues

Related to ADR-007 Memory-First Architecture implementation


🤖 Generated with Claude Code

rjmurillo-bot and others added 16 commits January 1, 2026 13:07
Copy commands, skills, and agent from ScottRBK/context-hub-plugin:

Commands:
- /context_gather - Multi-source context retrieval
- /encode-repo-serena - Repository encoding workflow
- /memory-search, /memory-list, /memory-save, /memory-explore

Skills:
- curating-memories - Memory maintenance workflows
- exploring-knowledge-graph - Knowledge graph traversal
- serena-code-architecture - Architectural analysis
- using-forgetful-memory - Memory patterns
- using-serena-symbols - Symbol analysis guidance

Agent:
- context-retrieval - Subagent for context gathering

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Enable forgetful, context7, context-hub plugins in settings.json
- Add forgetful MCP server config to .mcp.json (HTTP transport)
- Document Forgetful tools and usage patterns in CLAUDE.md
- Add Forgetful to memory system docs in copilot-instructions.md
- Add complete setup guide for Linux/Windows in CONTRIBUTING.md

Note: HTTP transport required due to FastMCP banner corruption
(upstream issue: ScottRBK/forgetful#19)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Install uv (Python package manager) for uvx command
- Start Forgetful MCP server in HTTP mode on port 8020
- Add health check verification in test summary
- Wait up to 30s for server startup

Enables AI agents in Copilot workspace to use semantic memory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
QA verification artifact for spec layer traceability implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement Claude Code hooks to enforce ADR-007 Memory-First Architecture
at runtime. Hooks inject context into Claude's session to ensure memory
retrieval precedes reasoning.

## Hooks
- Invoke-SessionStartMemoryFirst.ps1: Injects Phase 1/2 blocking gate
  requirements at session start (Serena init + context retrieval)
- Invoke-UserPromptMemoryCheck.ps1: Detects planning/implementation
  keywords and reminds about memory-first workflow

## Configuration
- .claude/settings.json: Registers hooks for SessionStart and
  UserPromptSubmit events using pwsh cross-platform execution

## Tests
- 34 Pester tests covering both hooks
- Keyword detection, case insensitivity, JSON parsing, output content

Addresses Issue #729 (E1: Claude Code Hooks)
Per ADR-005: PowerShell-only with Verb-Noun naming conventions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Multi-agent ADR review artifacts for ADR-007 Memory-First Architecture:

## Analysis
- ADR-007-enforcement-gap-analysis.md: Identifies 5 gaps, tracks E1/E3
  as resolved, E2/E4/E5 pending (Issue #729)
- ADR-007-related-work-research.md: Phase 0 research on related issues

## Critique (6-agent debate)
- ADR-007-debate-log.md: Full debate protocol, 6/6 consensus achieved
- ADR-007-memory-first-architecture-critique.md: Critic agent review
- ADR-007-analyst-independent-review.md: Analyst agent findings

## Serena Memories
- adr-007-augmentation-research.md: Forgetful/BMAD/Zettelkasten research
- memory-architecture-serena-primary.md: Serena as canonical layer
- skill-usage-mandatory.md: Fills gap referenced in CLAUDE.md (E3)

Completes ADR-007 review per adr-review skill protocol.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## ADR-007 Updates (per 6-agent review)
- Added Confirmation section with verification methods
- Added Implementation Status section
- Added Security Considerations (CWE references)
- Added Tool Selection clarification (Serena canonical)
- Added Relationship to Issue #167 section
- Qualified SWE-Bench claim per analyst feedback

## Context-Hub Commands
- Minor updates to memory commands from plugin integration
- Added context-retrieval agent configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Test-MemoryEvidence function to Validate-Session.ps1 that:
- Finds memory-index row in Session Start checklist
- Detects placeholder evidence (empty, template text, brackets)
- Extracts memory names using kebab-case regex pattern
- Verifies each memory exists in .serena/memories/

Error codes: E_MEMORY_EVIDENCE_INVALID, E_MEMORY_NOT_FOUND

Includes 12 Pester tests covering valid evidence, placeholder
detection, invalid names, and edge cases.

Closes trust gap where agents could self-report memory retrieval
without actually doing it.

Related: ADR-007, Issue #729

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add lightweight memory evidence check (lines 842-890) that:
- Finds memory-index row in staged session log
- Extracts Evidence column content
- Warns on placeholder patterns (empty, template text, brackets)
- Validates kebab-case memory name format

Non-blocking warning only - E2 validation provides full enforcement.

Related: ADR-007, Issue #729

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates to ADR-007 Memory-First Architecture:

- Fix memory workflow to Serena-first (was incorrectly Forgetful-first)
  Read → Augment → Persist → Commit

- Add Fallback Behavior section documenting graceful degradation:
  - Forgetful not running: Use Serena memory-index
  - Forgetful timeout: Proceed with loaded memories
  - Fresh environment: Full Serena workflow

- Document MUST NOT rules for fallback scenarios
- Add evidence format for Forgetful-unavailable sessions

Addresses P1 debate items: workflow priority, undefined fallback.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Mark E2 and E4 as complete in gap analysis:
- E2: Enhanced Session Validation (Validate-Session.ps1)
- E4: Pre-commit Memory Evidence Check (.githooks/pre-commit)

Update implementation priority table with completion status.
Update success criteria checklist (4/5 complete).

Remaining: E5 Forgetful Verification (P2)

Related: Issue #729

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive issue resolution handling:

## P0/P1 Resolution
- P0 must be fully addressed (blocking)
- P1 must be addressed OR deferred with justification + backlog issue

## P1 Deferral Requirements
- Documented justification in ADR/debate log
- GitHub issue with priority:P1, backlog, adr-followup labels
- Linked to related issues/ADRs for surfacing
- Keywords in title matching memory-index patterns

## Surfacing Mechanism (for amnesiac agents)
- GitHub issue linking (surfaces when working on linked items)
- Phase 0 search (searches label:adr-followup)
- Memory-index keywords (surfaces during Session Start)

## P2 Backlog
- Filed as GitHub issues with backlog, adr-followup labels
- Documented in debate log

Includes practical example, issue templates, and post-creation steps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- README.md: Comprehensive setup guide for humans and AI agents
- Install-ForgetfulLinux.ps1: systemd user service installation
- Install-ForgetfulWindows.ps1: Windows scheduled task installation
- Test-ForgetfulHealth.ps1: Health check with TCP and service status

Uses uvx for always-up-to-date package execution. HTTP transport on
port 8020 to work around upstream stdio bug (FastMCP banner corruption).

Related: ADR-007 Memory-First Architecture

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Hook now checks if Forgetful MCP is available via TCP port check and
provides appropriate guidance:

- When available: includes optional Forgetful step in context retrieval
- When unavailable: shows fallback guidance and installation commands

Uses TCP connection check instead of full MCP protocol (which requires
session initialization) for quick, reliable detection.

Related: ADR-007 Memory-First Architecture

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- CLAUDE.md: Add health check command and setup reference
- copilot-instructions.md: Add setup reference and health check

Points to scripts/forgetful/README.md for installation details.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Convert bash to PowerShell for consistency (ADR-005)
- Use TCP port check instead of invalid /health endpoint
- MCP HTTP transport requires session initialization for full protocol
- Reference scripts/forgetful/README.md for local setup documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 1, 2026 21:18
@github-actions github-actions Bot added enhancement New feature or request area-workflows GitHub Actions workflows automation Automated workflows and processes github-actions GitHub Actions workflow updates area-skills Skills documentation and patterns labels Jan 1, 2026
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown
Contributor

PR Validation Report

Note

Status: PASS

Description Validation

Check Status
Description matches diff PASS

QA Validation

Check Status
Code changes detected True
QA report exists false

⚡ Warnings

  • QA report not found for code changes (recommended before merge)

Powered by PR Validation workflow

@github-actions github-actions Bot added the needs-split PR has too many commits and should be split label Jan 1, 2026
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown
Contributor

Spec-to-Implementation Validation

Warning

No spec references found

This PR does not reference any specifications (REQ-, DESIGN-, TASK-*, or linked issues).

How to add spec references

Add spec references to your PR description to enable traceability:

Method Example
Reference requirements Implements REQ-001
Link issues Closes #123
Reference spec files .agents/specs/requirements/...

Spec Requirement by PR Type:

PR Type Required?
Feature (feat:) ✅ Required
Bug fix (fix:) Optional
Refactor (refactor:) Optional
Documentation (docs:) Not required
Infrastructure (ci:, build:, chore:) Optional

See PR template for full guidance.


Powered by AI Spec Validator workflow

@coderabbitai coderabbitai Bot requested a review from rjmurillo January 1, 2026 21:18

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant set of features to enforce the Memory-First Architecture (ADR-007) and provides comprehensive infrastructure for setting up the Forgetful MCP server. The changes include new agent definitions, Claude commands, skills, and PowerShell hooks for validation. Additionally, it adds installation scripts for Linux and Windows, health checks, and extensive documentation.

My review focuses on the new scripts and documentation. I've identified a few areas for improvement:

  • A PowerShell hook script does not adhere to the repository's error handling style guide.
  • The documentation for manual systemd service setup on Linux contains non-robust paths that could lead to user error.

Overall, this is a very thorough implementation of the ADR. The new enforcement mechanisms and setup scripts are well-structured. The suggested changes will improve the robustness and maintainability of the new components.

Comment thread .claude/hooks/Invoke-SessionStartMemoryFirst.ps1 Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread scripts/forgetful/README.md Outdated
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown
Contributor

AI Quality Gate Review

Tip

Final Verdict: PASS

Walkthrough

This PR was reviewed by six AI agents in parallel, analyzing different aspects of the changes:

  • Security Agent: Scans for vulnerabilities, secrets exposure, and security anti-patterns
  • QA Agent: Evaluates test coverage, error handling, and code quality
  • Analyst Agent: Assesses code quality, impact analysis, and maintainability
  • Architect Agent: Reviews design patterns, system boundaries, and architectural concerns
  • DevOps Agent: Evaluates CI/CD, build pipelines, and infrastructure changes
  • Roadmap Agent: Assesses strategic alignment, feature scope, and user value

Review Summary

Agent Verdict Category Status
Security PASS N/A
QA PASS N/A
Analyst PASS N/A
Architect PASS N/A
DevOps PASS N/A
Roadmap PASS N/A

💡 Quick Access: Click on individual agent jobs (e.g., "🔒 security Review", "🧪 qa Review") in the workflow run to see detailed findings and step summaries.

DevOps Review Details

Let me now review the test files mentioned in the PR and check the workflow more thoroughly for any potential issues.

Now I have enough information to provide the DevOps review.


DevOps Review: ADR-007 Memory-First Architecture

PR Scope Detection

Category Files Changed
WORKFLOW .github/workflows/copilot-setup-steps.yml
SCRIPT scripts/forgetful/*.ps1, .githooks/pre-commit
TEMPLATE None
CODE .claude/hooks/*.ps1
DOCS scripts/forgetful/README.md

Review Scope: Full CI/CD review, Shell quality review, Build impact assessment


Pipeline Impact Assessment

Area Impact Notes
Build Low No build system changes
Test Low New Pester tests added (34 tests)
Deploy None No deployment changes
Cost Low Forgetful server adds ~10 seconds to setup

CI/CD Quality Checks

Check Status Location
YAML syntax valid .github/workflows/copilot-setup-steps.yml
Actions pinned copilot-setup-steps.yml:44,49 (SHA pinned)
Secrets secure Only github.token used with minimal permissions
Permissions minimal contents: read, actions: read, pull-requests: read
Shell scripts robust .githooks/pre-commit uses set -e, proper quoting
PowerShell scripts All scripts use Set-StrictMode -Version Latest

Findings

Severity Category Finding Location Fix
Low Performance TCP connection check uses 30 max attempts with 1-second sleep copilot-setup-steps.yml:113-130 Acceptable for CI initialization
Low Hardening Forgetful health check could fail silently if process dies after startup copilot-setup-steps.yml:132-134 Warning is shown; non-blocking
Info Documentation README includes clear troubleshooting steps scripts/forgetful/README.md No action needed

Shell Script Quality Assessment

.githooks/pre-commit:

Check Status Notes
Input validation REPO_ROOT validated with existence check
Error handling Uses set -e, proper exit codes
Symlink protection MEDIUM-002 checks throughout
Array safety Uses mapfile for safe array construction
Command injection Uses PSANALYZER_FILE env var, -- separators
Exit codes EXIT_STATUS tracking, proper propagation

PowerShell Scripts (scripts/forgetful/*.ps1, .claude/hooks/*.ps1):

Check Status Notes
StrictMode All scripts use Set-StrictMode -Version Latest
ErrorActionPreference Set to 'Stop' for fail-fast
Parameter validation CmdletBinding with proper param blocks
Resource cleanup TcpClient disposed in finally blocks
Cross-platform $IsLinux/$IsWindows checks present

Workflow Specific Analysis

copilot-setup-steps.yml:

Aspect Assessment
Actions pinning SHA-pinned (actions/checkout@34e1..., actions/setup-node@4993...)
Permissions Minimal and appropriate
Shell usage Uses pwsh for PowerShell steps (ADR-005 compliant)
uv installation Uses official installer with proper PATH update
Forgetful startup Background process with TCP port verification
Error handling Non-blocking warnings if Forgetful fails to start
Pester version Pinned to 5.7.1 for supply chain security

Template Assessment

  • PR Template: Not modified in this PR
  • Issue Templates: Not modified in this PR

Automation Opportunities

Opportunity Type Benefit Effort
Forgetful health in CI Action Consistent MCP verification Low

Recommendations

  1. The TCP port check loop (30 attempts × 1 second) is appropriate for service startup in CI.
  2. The fallback behavior when Forgetful is unavailable is well-documented and non-blocking.
  3. All PowerShell scripts follow security best practices with StrictMode and proper error handling.

Verdict

VERDICT: PASS
MESSAGE: CI/CD changes are well-configured with SHA-pinned actions, minimal permissions, robust shell scripts, and proper error handling. The Forgetful MCP integration is non-blocking with appropriate fallback behavior.
Roadmap Review Details

Strategic Alignment Assessment

Criterion Rating Notes
Aligns with project goals High Memory-First Architecture directly supports "coordinated multi-agent AI workflows" by ensuring cross-session context continuity
Priority appropriate High ADR-007 is foundational infrastructure that enables all agent workflows to benefit from institutional knowledge
User value clear High Agents inherit learnings, patterns discovered once benefit all future sessions
Investment justified High 34 Pester tests, enforcement hooks, setup scripts provide measurable quality gates

Feature Completeness

Impact Analysis

Dimension Assessment Notes
User Value High Solves the "expert amnesiac" problem documented in AGENTS.md
Business Impact High Reduces repeated work, improves agent consistency across sessions
Technical Leverage High Enforcement mechanisms (hooks, validators) are reusable patterns
Competitive Position Improved Differentiates from agents without memory continuity

Concerns

Priority Concern Recommendation
Low Forgetful MCP is local-only while Serena is cross-platform ADR-007 correctly positions Forgetful as supplementary, not canonical. Accept as designed.
Low CI uses TCP port check vs health endpoint Documented as intentional (MCP requires session init). Accept.

Recommendations

  1. Merge as-is. ADR-007 Memory-First Architecture aligns with the Master Product Objective by enabling agent continuity across sessions.
  2. Track Issue M1-003: Implement Serena Integration Layer #584 (Serena Integration Layer) in next roadmap review for v1.2+ consideration.
  3. Consider adding Memory-First Architecture to the Success Metrics table once baseline data is collected.

Verdict

VERDICT: PASS
MESSAGE: ADR-007 Memory-First Architecture enforcement is strategically aligned, properly scoped, and delivers high user value by solving the cross-session amnesia problem. 6/6 agent consensus in multi-agent review confirms architectural soundness.
QA Review Details

Now let me check the scripts folder for Forgetful and look at the GitHub workflow changes mentioned in the PR:

Now I have sufficient information to provide the QA review. Let me compile my analysis:


PR Quality Gate Review

VERDICT: PASS
MESSAGE: All new enforcement mechanisms have comprehensive test coverage with 34 tests across 3 test files.

PR TYPE: MIXED
FILES: 
  - CODE: .claude/hooks/*.ps1, scripts/forgetful/*.ps1, scripts/Validate-Session.ps1 (Test-MemoryEvidence function)
  - WORKFLOW: .github/workflows/copilot-setup-steps.yml
  - DOCS: scripts/forgetful/README.md
  - CONFIG/INFRA: .githooks/pre-commit

EVIDENCE:
- Tests found: 34 for 4 new functions/modules (Test-MemoryEvidence: 12, SessionStart hook: 8, UserPrompt hook: 14)
- Edge cases: Covered (placeholder detection, case insensitivity, malformed JSON, missing memories)
- Error handling: Tested (JSON parsing errors, TCP connection failures)
- Blocking issues: 0

Test Coverage Assessment

Area Status Evidence Files Checked
Unit tests Adequate tests/Test-MemoryEvidence.Tests.ps1 (12 tests), tests/Invoke-SessionStartMemoryFirst.Tests.ps1 (8 tests), tests/Invoke-UserPromptMemoryCheck.Tests.ps1 (14 tests) All new hooks and Validate-Session.ps1
Edge cases Covered Placeholder patterns (empty, template, bracketed, dashes), case insensitivity, malformed JSON, deduplication Lines 77-111, 132-158 in Test-MemoryEvidence.Tests.ps1
Error paths Tested TCP connection failures (line 48-56 in hook), JSON parse errors (lines 166-171 in UserPrompt tests), missing memories (lines 114-131) All hook scripts
Assertions Present Should -Be, Should -Match, Should -Contain, Should -Not -Throw assertions throughout All test files

Quality Concerns

Severity Issue Location Evidence Required Fix
LOW Install scripts not tested scripts/forgetful/Install-ForgetfulLinux.ps1, Install-ForgetfulWindows.ps1 No corresponding test files These are deployment utilities with platform-specific behavior; manual testing is documented
LOW Test-ForgetfulHealth.ps1 not tested scripts/forgetful/Test-ForgetfulHealth.ps1 No test file Diagnostic script with manual verification instructions in output

Regression Risk Assessment

  • Risk Level: Low
  • Affected Components:
    • Session validation pipeline (Validate-Session.ps1)
    • Claude hooks (.claude/hooks/)
    • Pre-commit validation (.githooks/pre-commit)
    • CI setup (copilot-setup-steps.yml)
  • Breaking Changes: None - new enforcement mechanisms are additive
  • Required Testing: All 34 Pester tests passing (claimed in PR description)

Code Quality Observations

  1. Validate-Session.ps1 (Test-MemoryEvidence): Well-structured function with clear input validation, placeholder detection, and memory existence verification. Lines 254-351.

  2. Invoke-SessionStartMemoryFirst.ps1: Clean separation of MCP availability check and context output. Proper TCP cleanup in finally block (lines 54-57).

  3. Invoke-UserPromptMemoryCheck.ps1: Comprehensive keyword detection with proper JSON error handling (lines 49-59).

  4. Pre-commit hook: Memory evidence warning (lines 852-890) provides non-blocking guidance with clear next steps.

  5. CI workflow: Uses TCP port check instead of invalid /health endpoint - correctly accounts for MCP protocol requiring session initialization.


Fail-Safe Pattern Verification

Pattern Status Evidence
Input validation [PASS] JSON parsing with try-catch (line 49-59 in UserPrompt hook), TCP timeout handling
Error handling [PASS] Exception caught with meaningful message in SessionStart hook (line 50-52)
Timeout handling [PASS] TCP connections have 1-2 second timeouts throughout
Fallback behavior [PASS] Serena-only workflow documented when Forgetful unavailable (lines 72-79 in SessionStart hook)

Summary

This PR implements ADR-007 Memory-First Architecture enforcement with:

  • E2 Enhanced Session Validation: Test-MemoryEvidence function validates Evidence column contains actual memory names that exist on disk
  • E4 Pre-commit Warning: Pattern matching for memory evidence in session logs (non-blocking)
  • SessionStart Hook: MCP availability check with fallback guidance
  • UserPromptSubmit Hook: Memory-first compliance reminder for planning/implementation keywords

All 34 tests cover the critical enforcement paths. The install scripts are deployment utilities that require platform-specific manual testing, which is acceptable for this PR type.

Architect Review Details

Based on my comprehensive review of this PR, here is my architectural assessment:


Design Quality Assessment

Aspect Rating (1-5) Notes
Pattern Adherence 4 Follows ADR pattern, DRY principle with shared config
Boundary Respect 5 Clean separation: hooks in .claude/hooks/, scripts in scripts/forgetful/, tests in tests/
Coupling 4 Hooks are loosely coupled; Forgetful is supplementary to Serena (graceful degradation)
Cohesion 5 Each script has single responsibility (session start, prompt check, health check)
Extensibility 5 Dual memory architecture allows adding backends; hook system is plugin-based

Overall Design Score: 4.6/5


Architectural Concerns

Severity Concern Location Recommendation
Low TCP port check is basic validation .claude/hooks/Invoke-SessionStartMemoryFirst.ps1:37-47 Acceptable for startup check; full MCP validation deferred to Claude
Low Hardcoded port 8020 in multiple locations Various files Consider extracting to shared constant, but acceptable for now
Low Pre-commit hook growing large (1043 lines) .githooks/pre-commit Monitor complexity; consider modularization if it grows further

Breaking Change Assessment

  • Breaking Changes: No
  • Impact Scope: None
  • Migration Required: No
  • Migration Path: N/A

The PR adds new enforcement mechanisms without modifying existing interfaces. Forgetful is supplementary (graceful degradation when unavailable). Existing workflows continue to work.


Technical Debt Analysis

  • Debt Added: Low (new infrastructure files are well-documented)
  • Debt Reduced: Medium (ADR-007 enforcement reduces repeated discovery patterns)
  • Net Impact: Improved

The PR reduces institutional knowledge loss by enforcing memory-first patterns. The added infrastructure is maintainable.


ADR Assessment

  • ADR Required: No (existing ADR-007 covers this implementation)
  • Decisions Identified:
    • HTTP transport for Forgetful (stdio broken)
    • TCP port check vs MCP protocol validation
    • Serena canonical, Forgetful supplementary
  • Existing ADR: ADR-007 Memory-First Architecture (updated in this PR)
  • Recommendation: N/A (ADR-007 already documents these decisions)

Recommendations

  1. The Forgetful fallback behavior is well-designed with graceful degradation to Serena-only workflow
  2. Test coverage is comprehensive (34 Pester tests covering E2 validation, hooks)
  3. CI integration via copilot-setup-steps.yml uses TCP check correctly (MCP requires session init)

Verdict

VERDICT: PASS
MESSAGE: Architecture is sound. ADR-007 enforcement mechanisms follow established patterns with clean separation of concerns. Dual memory architecture (Serena canonical + Forgetful supplementary) provides appropriate resilience.
Security Review Details

Based on my review of the changed files, I can now provide the security assessment.

Security Review: ADR-007 Memory-First Architecture

PR Type: WORKFLOW + CODE

Files reviewed:

  • .github/workflows/copilot-setup-steps.yml - CI workflow with Forgetful server startup
  • .githooks/pre-commit - Memory evidence validation hook
  • scripts/forgetful/*.ps1 - Installation and health check scripts
  • .claude/hooks/*.ps1 - Claude Code session hooks

Findings

Severity Category Finding Location CWE
Medium Command Injection Prevention Proper use of $env: variables to pass paths to PowerShell, preventing shell metacharacter injection .githooks/pre-commit:288 CWE-78
Low Input Validation TCP port check uses hardcoded port, no external input scripts/forgetful/*.ps1 N/A
Info Permissions Workflow uses minimal permissions: contents: read, actions: read, pull-requests: read copilot-setup-steps.yml:26-28 N/A
Info Action Pinning All GitHub Actions are pinned to commit SHAs copilot-setup-steps.yml:44,49 N/A

Security Controls Verified

  1. Workflow Security

    • Actions pinned to SHA (checkout, setup-node)
    • Minimal permissions declared
    • No secrets exposed in logs
    • ${{ github.token }} properly scoped to repo
  2. Pre-commit Hook Security

    • Symlink checks prevent TOCTOU attacks (MEDIUM-002)
    • Array-safe file handling prevents command injection (CRITICAL-001)
    • Environment variable passing (PSANALYZER_FILE) prevents shell escape
  3. Installation Scripts

    • No credential handling
    • Port validation before binding
    • Service files use hardcoded paths, not user input
  4. Claude Hooks

    • Input parsed via ConvertFrom-Json with error handling
    • No shell command execution from user input
    • Output is informational only (exit 0)

Recommendations

None blocking. Minor observations:

  1. INFO: The health check script at line 165 sends a JSON-RPC request. This is expected MCP protocol behavior.
  2. INFO: curl command in README.md is documentation, not executed code.

Verdict

VERDICT: PASS
MESSAGE: No security vulnerabilities found. Workflow permissions are minimal, actions are pinned, and scripts follow secure coding patterns for command injection prevention.
Analyst Review Details

Let me check the local repository for the PR changes and relevant files.

Let me examine the ADR-007 and related architecture files, and run the existing tests to establish baseline.

Now I have a complete picture of the PR changes. Let me view the architecture ADR-007 document and examine the security aspects of the workflow.

Now let me check the security review and examine one more aspect.

Based on my comprehensive review of this PR, I can now provide the analysis.


Analyst PR Review: ADR-007 Memory-First Architecture Enforcement

Code Quality Score

Criterion Score (1-5) Notes
Readability 5 Clear function names, consistent comment patterns, proper PowerShell help blocks
Maintainability 5 Modular functions (Test-MemoryEvidence), comprehensive test coverage (34 tests)
Consistency 5 Follows established patterns: ADR documentation format, pre-commit hook patterns, Pester test structure
Simplicity 4 Some complexity in regex patterns for memory extraction, but necessary for validation

Overall: 4.75/5

Impact Assessment

  • Scope: Module-wide (affects session validation, git hooks, CI workflow)
  • Risk Level: Low - enforcement mechanisms are additive, not modifying existing behavior
  • Affected Components:
    • scripts/Validate-Session.ps1 (E2 validation added)
    • .githooks/pre-commit (E4 memory evidence warning)
    • .claude/hooks/Invoke-SessionStartMemoryFirst.ps1 (new hook)
    • .claude/hooks/Invoke-UserPromptMemoryCheck.ps1 (new hook)
    • .github/workflows/copilot-setup-steps.yml (Forgetful startup)
    • scripts/forgetful/ (new setup infrastructure)
    • tests/*.Tests.ps1 (34 new tests)

Findings

Priority Category Finding Location
Low Security TCP client connection uses 1-second timeout which may cause false negatives .claude/hooks/Invoke-SessionStartMemoryFirst.ps1:37
Low Documentation Forgetful upstream issue #19 is documented as workaround, good traceability scripts/forgetful/README.md:7
Low Best Practice Port 8020 is hardcoded in multiple locations; consider centralizing copilot-setup-steps.yml:112, Test-ForgetfulHealth.ps1:40
Info Coverage 34 Pester tests across 3 test files is comprehensive for enforcement mechanisms tests/Test-MemoryEvidence.Tests.ps1, etc.
Info Architecture Dual memory architecture (Serena-canonical, Forgetful-supplementary) is well-documented ADR-007-memory-first-architecture.md:84-98
Info Fallback Graceful degradation when Forgetful unavailable is documented and implemented ADR-007:104-131, Invoke-SessionStartMemoryFirst.ps1:72-79

Recommendations

  1. Port Configuration: Consider extracting port 8020 to a shared configuration file or environment variable to reduce duplication across scripts and workflows.

  2. Health Check Enhancement: The Test-ForgetfulHealth.ps1 correctly uses TCP check since MCP requires session initialization. The approach is sound given the upstream protocol constraints.

  3. Pre-commit Hook: The E4 memory evidence warning (lines 852-890) is non-blocking and informative, which aligns with the progressive enforcement strategy.

Security Review

Infrastructure Changes:

  • copilot-setup-steps.yml: Uses pinned action versions (good), starts Forgetful in background with process ID tracking
  • .githooks/pre-commit: Memory evidence check is read-only, no command injection risk
  • .claude/hooks/*.ps1: TCP client operations use proper disposal patterns (finally block)

No Critical Security Issues: The changes follow established security patterns in the repository. TCP client operations are properly scoped and disposed.

Verdict

VERDICT: PASS
MESSAGE: Well-structured enforcement of ADR-007 Memory-First Architecture with comprehensive test coverage (34 tests), proper fallback handling, and security-conscious implementation. Minor opportunities for port configuration centralization.

Run Details
Property Value
Run ID 20647057044
Triggered by pull_request on 730/merge
Commit c74da3eab051e68b3c2b90411a7098b788bd9273

Powered by AI Quality Gate workflow

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements comprehensive ADR-007 Memory-First Architecture enforcement mechanisms and establishes Forgetful MCP server setup infrastructure. The changes transition memory-first from aspirational documentation to automated enforcement through validation, hooks, and infrastructure.

Key Changes

  • Enforcement Mechanisms: Enhanced session validation with Test-MemoryEvidence function, pre-commit memory evidence warnings, and Claude Code lifecycle hooks (SessionStart, UserPromptSubmit)
  • Forgetful Infrastructure: Complete setup automation for Linux (systemd) and Windows (scheduled tasks) with comprehensive health checking
  • ADR-007 Enhancements: Added fallback behavior documentation, corrected memory workflow to Serena-first, clarified tool selection rationale
  • Test Coverage: 34 new Pester tests covering all enforcement mechanisms with 100% pass rate

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Test-MemoryEvidence.Tests.ps1 12 Pester tests for E2 validation (placeholder detection, memory file verification)
tests/Invoke-UserPromptMemoryCheck.Tests.ps1 14 tests for UserPromptSubmit hook (keyword detection, output content)
tests/Invoke-SessionStartMemoryFirst.Tests.ps1 8 tests for SessionStart hook (output content validation)
scripts/forgetful/Test-ForgetfulHealth.ps1 Health check with TCP connectivity and service status verification
scripts/forgetful/README.md Comprehensive setup documentation covering HTTP transport rationale
scripts/forgetful/Install-ForgetfulWindows.ps1 Scheduled task installation with automatic startup
scripts/forgetful/Install-ForgetfulLinux.ps1 Systemd user service installation with daemon management
scripts/Validate-Session.ps1 Added Test-MemoryEvidence function (E2 enforcement)
.githooks/pre-commit Memory evidence warning (E4 enforcement)
.claude/hooks/Invoke-UserPromptMemoryCheck.ps1 UserPromptSubmit hook with keyword-based memory reminders
.claude/hooks/Invoke-SessionStartMemoryFirst.ps1 SessionStart hook with blocking gate requirements
.claude/settings.json Hook registration and Forgetful plugin enablement
.serena/memories/skill-usage-mandatory.md New memory documenting mandatory skill usage before GitHub operations
.serena/memories/memory-architecture-serena-primary.md Documents Serena as primary persistence layer
.serena/memories/adr-007-augmentation-research.md Research summary for ADR-007 augmentation
.agents/architecture/ADR-007-memory-first-architecture.md Enhanced with fallback behavior, corrected workflow, tool selection
.agents/critique/* Multi-agent ADR review artifacts (debate log, critique, analyst review)
.agents/analysis/* Related work research and enforcement gap analysis
.mcp.json Added Forgetful MCP configuration
.github/workflows/copilot-setup-steps.yml Forgetful server startup in CI with TCP health check
CONTRIBUTING.md, CLAUDE.md, .github/copilot-instructions.md Forgetful setup documentation
.claude/skills/* New skills for Serena symbols, Forgetful memory, architecture analysis
.claude/commands/* New commands for memory operations and context gathering
.claude/agents/context-retrieval.md New context-retrieval agent for memory-first workflows

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 45 out of 45 changed files in this pull request and generated no new comments.

rjmurillo-bot and others added 5 commits January 1, 2026 17:00
- Add $LASTEXITCODE checks after systemctl commands in Linux installer
- Wrap Register-ScheduledTask in try/catch in Windows installer
- Exit with code 1 on failure with descriptive error messages

Addresses PR #730 review findings (P1-1, P1-2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace incorrect REST /health endpoint with correct JSON-RPC POST
to /mcp endpoint using tools/list method. Matches actual MCP protocol
used by installation scripts.

Addresses PR #730 review findings (P1-3)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add finally block with Dispose() for TcpClient to ensure cleanup
on all code paths (success, timeout, exception). Follows .NET
IDisposable best practices.

Addresses PR #730 review findings (P2-1)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Handle edge case where TCP connection attempt completes but
$tcpClient.Connected is false. Sets explicit "connection timeout"
message for better debugging.

Addresses PR #730 review findings (P2-2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename skill-usage-mandatory to usage-mandatory across 7 files.
ADR-017 removed skill- prefix from memory naming convention.

Files updated:
- AGENTS.md (4 refs)
- src/claude/AGENTS.md (2 refs)
- .claude/skills/AGENTS.md (3 refs)
- .claude/agents/AGENTS.md (2 refs)
- .claude/skills/github/references/api-reference.md (1 ref)
- .claude/skills/session-log-fixer/references/template-sections.md (2 refs)
- docs/technical-guardrails.md (1 ref)

Addresses PR #730 review findings (P3-2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rjmurillo rjmurillo added the commit-limit-bypass Allows PR to exceed 20 commit limit label Jan 1, 2026
@rjmurillo rjmurillo enabled auto-merge (squash) January 1, 2026 23:08
@rjmurillo rjmurillo merged commit 51d2995 into main Jan 1, 2026
42 of 44 checks passed
@rjmurillo rjmurillo deleted the feat/memory branch January 1, 2026 23:10
rjmurillo-bot pushed a commit that referenced this pull request Jan 2, 2026
Resolved conflicts by taking main's version for:
- PowerShell hooks (ADR-005 compliance)
- Forgetful installation scripts
- ADR-007 documentation updates
- Workflow PowerShell conversion

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
rjmurillo pushed a commit that referenced this pull request Jan 3, 2026
* feat(context-hub): add context-hub commands and skills

Copy commands, skills, and agent from ScottRBK/context-hub-plugin:

Commands:
- /context_gather - Multi-source context retrieval
- /encode-repo-serena - Repository encoding workflow
- /memory-search, /memory-list, /memory-save, /memory-explore

Skills:
- curating-memories - Memory maintenance workflows
- exploring-knowledge-graph - Knowledge graph traversal
- serena-code-architecture - Architectural analysis
- using-forgetful-memory - Memory patterns
- using-serena-symbols - Symbol analysis guidance

Agent:
- context-retrieval - Subagent for context gathering

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(forgetful): add Forgetful MCP integration documentation

- Enable forgetful, context7, context-hub plugins in settings.json
- Add forgetful MCP server config to .mcp.json (HTTP transport)
- Document Forgetful tools and usage patterns in CLAUDE.md
- Add Forgetful to memory system docs in copilot-instructions.md
- Add complete setup guide for Linux/Windows in CONTRIBUTING.md

Note: HTTP transport required due to FastMCP banner corruption
(upstream issue: ScottRBK/forgetful#19)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(copilot): add Forgetful MCP server to setup steps

- Install uv (Python package manager) for uvx command
- Start Forgetful MCP server in HTTP mode on port 8020
- Add health check verification in test summary
- Wait up to 30s for server startup

Enables AI agents in Copilot workspace to use semantic memory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(qa): add Phase 2 traceability verification for PR #715

QA verification artifact for spec layer traceability implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(hooks): add ADR-007 memory-first enforcement hooks

Implement Claude Code hooks to enforce ADR-007 Memory-First Architecture
at runtime. Hooks inject context into Claude's session to ensure memory
retrieval precedes reasoning.

## Hooks
- Invoke-SessionStartMemoryFirst.ps1: Injects Phase 1/2 blocking gate
  requirements at session start (Serena init + context retrieval)
- Invoke-UserPromptMemoryCheck.ps1: Detects planning/implementation
  keywords and reminds about memory-first workflow

## Configuration
- .claude/settings.json: Registers hooks for SessionStart and
  UserPromptSubmit events using pwsh cross-platform execution

## Tests
- 34 Pester tests covering both hooks
- Keyword detection, case insensitivity, JSON parsing, output content

Addresses Issue #729 (E1: Claude Code Hooks)
Per ADR-005: PowerShell-only with Verb-Noun naming conventions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(adr-007): add enforcement gap analysis and review artifacts

Multi-agent ADR review artifacts for ADR-007 Memory-First Architecture:

## Analysis
- ADR-007-enforcement-gap-analysis.md: Identifies 5 gaps, tracks E1/E3
  as resolved, E2/E4/E5 pending (Issue #729)
- ADR-007-related-work-research.md: Phase 0 research on related issues

## Critique (6-agent debate)
- ADR-007-debate-log.md: Full debate protocol, 6/6 consensus achieved
- ADR-007-memory-first-architecture-critique.md: Critic agent review
- ADR-007-analyst-independent-review.md: Analyst agent findings

## Serena Memories
- adr-007-augmentation-research.md: Forgetful/BMAD/Zettelkasten research
- memory-architecture-serena-primary.md: Serena as canonical layer
- skill-usage-mandatory.md: Fills gap referenced in CLAUDE.md (E3)

Completes ADR-007 review per adr-review skill protocol.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: update ADR-007 and context-hub commands

## ADR-007 Updates (per 6-agent review)
- Added Confirmation section with verification methods
- Added Implementation Status section
- Added Security Considerations (CWE references)
- Added Tool Selection clarification (Serena canonical)
- Added Relationship to Issue #167 section
- Qualified SWE-Bench claim per analyst feedback

## Context-Hub Commands
- Minor updates to memory commands from plugin integration
- Added context-retrieval agent configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(validation): add memory evidence validation (E2, ADR-007)

Add Test-MemoryEvidence function to Validate-Session.ps1 that:
- Finds memory-index row in Session Start checklist
- Detects placeholder evidence (empty, template text, brackets)
- Extracts memory names using kebab-case regex pattern
- Verifies each memory exists in .serena/memories/

Error codes: E_MEMORY_EVIDENCE_INVALID, E_MEMORY_NOT_FOUND

Includes 12 Pester tests covering valid evidence, placeholder
detection, invalid names, and edge cases.

Closes trust gap where agents could self-report memory retrieval
without actually doing it.

Related: ADR-007, Issue #729

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(hooks): add memory evidence warning in pre-commit (E4, ADR-007)

Add lightweight memory evidence check (lines 842-890) that:
- Finds memory-index row in staged session log
- Extracts Evidence column content
- Warns on placeholder patterns (empty, template text, brackets)
- Validates kebab-case memory name format

Non-blocking warning only - E2 validation provides full enforcement.

Related: ADR-007, Issue #729

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(adr): add fallback behavior and fix workflow priority (ADR-007)

Updates to ADR-007 Memory-First Architecture:

- Fix memory workflow to Serena-first (was incorrectly Forgetful-first)
  Read → Augment → Persist → Commit

- Add Fallback Behavior section documenting graceful degradation:
  - Forgetful not running: Use Serena memory-index
  - Forgetful timeout: Proceed with loaded memories
  - Fresh environment: Full Serena workflow

- Document MUST NOT rules for fallback scenarios
- Add evidence format for Forgetful-unavailable sessions

Addresses P1 debate items: workflow priority, undefined fallback.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(analysis): update ADR-007 enforcement gap status

Mark E2 and E4 as complete in gap analysis:
- E2: Enhanced Session Validation (Validate-Session.ps1)
- E4: Pre-commit Memory Evidence Check (.githooks/pre-commit)

Update implementation priority table with completion status.
Update success criteria checklist (4/5 complete).

Remaining: E5 Forgetful Verification (P2)

Related: Issue #729

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(skill): add issue resolution protocol to adr-review

Add comprehensive issue resolution handling:

## P0/P1 Resolution
- P0 must be fully addressed (blocking)
- P1 must be addressed OR deferred with justification + backlog issue

## P1 Deferral Requirements
- Documented justification in ADR/debate log
- GitHub issue with priority:P1, backlog, adr-followup labels
- Linked to related issues/ADRs for surfacing
- Keywords in title matching memory-index patterns

## Surfacing Mechanism (for amnesiac agents)
- GitHub issue linking (surfaces when working on linked items)
- Phase 0 search (searches label:adr-followup)
- Memory-index keywords (surfaces during Session Start)

## P2 Backlog
- Filed as GitHub issues with backlog, adr-followup labels
- Documented in debate log

Includes practical example, issue templates, and post-creation steps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(forgetful): add MCP server setup scripts and documentation

- README.md: Comprehensive setup guide for humans and AI agents
- Install-ForgetfulLinux.ps1: systemd user service installation
- Install-ForgetfulWindows.ps1: Windows scheduled task installation
- Test-ForgetfulHealth.ps1: Health check with TCP and service status

Uses uvx for always-up-to-date package execution. HTTP transport on
port 8020 to work around upstream stdio bug (FastMCP banner corruption).

Related: ADR-007 Memory-First Architecture

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(hooks): add MCP availability check to SessionStart hook

Hook now checks if Forgetful MCP is available via TCP port check and
provides appropriate guidance:

- When available: includes optional Forgetful step in context retrieval
- When unavailable: shows fallback guidance and installation commands

Uses TCP connection check instead of full MCP protocol (which requires
session initialization) for quick, reliable detection.

Related: ADR-007 Memory-First Architecture

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add Forgetful setup references to instruction files

- CLAUDE.md: Add health check command and setup reference
- copilot-instructions.md: Add setup reference and health check

Points to scripts/forgetful/README.md for installation details.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(ci): update Forgetful setup to use PowerShell and TCP check

- Convert bash to PowerShell for consistency (ADR-005)
- Use TCP port check instead of invalid /health endpoint
- MCP HTTP transport requires session initialization for full protocol
- Reference scripts/forgetful/README.md for local setup documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(pr-730): address CI failures and reviewer feedback

## Root Causes Fixed
1. Memory file naming violation (ADR-017): Remove duplicate skill-usage-mandatory.md
   - File used 'skill-' prefix which violates ADR-017 naming convention
   - usage-mandatory.md already exists with same content
   - Updated CLAUDE.md references to use 'usage-mandatory'

2. ErrorActionPreference style violation (gemini-code-assist feedback)
   - Changed from 'SilentlyContinue' to 'Stop' per style guide
   - Added 'finally' block for proper resource cleanup

3. systemd ExecStart paths (gemini-code-assist feedback)
   - Changed /home/$USER/ to %h/ specifier for portability
   - Applied in both CONTRIBUTING.md and scripts/forgetful/README.md

4. Fixed corrupted PowerShell comment terminator
   - '# >' was corrupted to '# >' (with space) by linting

## Not Fixed (pre-existing CI issue)
- Generate-Skills.Tests.ps1 failure: PSGallery not accessible
  (powershell-yaml module install fails)
  User has added PSGallery URLs to firewall allowlist

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(hooks): add pre-PR validation gate to UserPromptSubmit hook

Enhances UserPromptSubmit hook to detect PR creation requests and inject
pre-PR validation checklist. This prevents CI failures by reminding the
agent to:

1. Run local Pester tests
2. Validate PowerShell script syntax
3. Check memory file naming (ADR-017)
4. Read validation-pre-pr-checklist memory
5. Avoid running markdownlint on .ps1 files

Triggered by keywords: "create pr", "open pull request", "gh pr create"

Adds 8 new Pester tests for PR detection functionality.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(hooks): add gh CLI skill usage detection to UserPromptSubmit hook

Enhances the UserPromptMemoryCheck hook to detect GitHub CLI commands
and remind users to check for existing skills before using raw gh CLI.

Detected commands:
- gh pr create/list/view/merge/close/checks/review/comment/diff/ready/status
- gh issue create/list/view/close/comment/edit
- gh api (including GraphQL)
- gh run/workflow

Test coverage:
- 75 tests covering all detection patterns
- Case insensitivity verification
- Multiple trigger combination tests
- Non-triggering pattern tests

Memory:
- Added validation-pre-pr-checklist memory with CI failure learnings

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(hooks): address PR #730 review findings

Fixes identified by multi-agent review (code-reviewer, silent-failure-hunter,
pr-test-analyzer, comment-analyzer):

## Critical Fixes
- Add exception logging to silent catch block (Invoke-SessionStartMemoryFirst.ps1:45-47)
- Replace TcpClient.Close() with Dispose() for proper cleanup
- Fix SilentlyContinue to ErrorAction Stop (Invoke-UserPromptMemoryCheck.ps1:50)
- Fix .sh references to .ps1 in ADR-007-enforcement-gap-analysis.md

## Naming Consistency (ADR-017 Compliance)
- Update SESSION-PROTOCOL.md to use usage-mandatory (not skill-usage-mandatory)
- Update PROJECT-CONSTRAINTS.md to use usage-mandatory
- Update gap analysis document to reference correct file path
- Update code-style-conventions.md with correct path

## Governance
- Add historical-reference-protocol.md for artifact traceability

All 84 Pester tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(forgetful): add error handling to installation scripts

- Add $LASTEXITCODE checks after systemctl commands in Linux installer
- Wrap Register-ScheduledTask in try/catch in Windows installer
- Exit with code 1 on failure with descriptive error messages

Addresses PR #730 review findings (P1-1, P1-2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(forgetful): fix health endpoint verification in CONTRIBUTING.md

Replace incorrect REST /health endpoint with correct JSON-RPC POST
to /mcp endpoint using tools/list method. Matches actual MCP protocol
used by installation scripts.

Addresses PR #730 review findings (P1-3)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(forgetful): add proper resource disposal in health check

Add finally block with Dispose() for TcpClient to ensure cleanup
on all code paths (success, timeout, exception). Follows .NET
IDisposable best practices.

Addresses PR #730 review findings (P2-1)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(hooks): add else clause for TCP connection timeout

Handle edge case where TCP connection attempt completes but
$tcpClient.Connected is false. Sets explicit "connection timeout"
message for better debugging.

Addresses PR #730 review findings (P2-2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(docs): update memory name references per ADR-017

Rename skill-usage-mandatory to usage-mandatory across 7 files.
ADR-017 removed skill- prefix from memory naming convention.

Files updated:
- AGENTS.md (4 refs)
- src/claude/AGENTS.md (2 refs)
- .claude/skills/AGENTS.md (3 refs)
- .claude/agents/AGENTS.md (2 refs)
- .claude/skills/github/references/api-reference.md (1 ref)
- .claude/skills/session-log-fixer/references/template-sections.md (2 refs)
- docs/technical-guardrails.md (1 ref)

Addresses PR #730 review findings (P3-2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(docs): use placeholder notation in historical protocol example

Change ADR cross-reference example from real ADR-005 reference to
placeholder notation (ADR-NNN, YYYY-MM-DD, Issue #NNN) to clarify
this is a format template, not documenting a real relationship.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(docs): add dates to historical references per protocol

Add missing dates to PR, issue, and commit references in analysis
documents per historical-reference-protocol.md requirements.

Files fixed:
- 003-quality-gate-comment-caching-rca.md: 5 references
- 281-similar-pr-detection-review.md: 3 references

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(session): complete Session 123 with memory update

- Finalized session log with PR reference
- Added Serena memory for historical reference compliance learnings

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: rjmurillo[bot] <rjmurillo-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@rjmurillo rjmurillo added this to the 0.2.0 milestone Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-critic Plan validation agent agent-memory Context persistence agent agent-orchestrator Task coordination agent agent-qa Testing and verification agent agent-retrospective Learning extraction agent area-infrastructure Build, CI/CD, configuration area-skills Skills documentation and patterns area-workflows GitHub Actions workflows automation Automated workflows and processes commit-limit-bypass Allows PR to exceed 20 commit limit documentation Improvements or additions to documentation enhancement New feature or request github-actions GitHub Actions workflow updates needs-split PR has too many commits and should be split triage:approved Human has triaged and approved bot responses for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants