# Release v1.4.7: ReasoningBank CLI Fix

## 🐛 Bug Fix Release

This is a critical bug fix release that resolves the ReasoningBank CLI commands not being accessible in the published npm package v1.4.6.

## Issue Summary

**Problem:** Users installing `agentic-flow@1.4.6` via npm could not access ReasoningBank CLI commands despite the feature being fully documented and implemented.

```bash
# This command showed no ReasoningBank section:
npx agentic-flow@1.4.6 reasoningbank help
# Output: Only showed standard commands (config, mcp, agent, proxy, claude-code)
```

**Root Cause:** The v1.4.6 npm package was published before the TypeScript build completed, resulting in incomplete dist/ files being uploaded to npm.

## What's Fixed in v1.4.7

### ✅ ReasoningBank CLI Now Accessible

All 5 ReasoningBank commands are now available after installation:

```bash
npx agentic-flow@1.4.7 reasoningbank help
npx agentic-flow@1.4.7 reasoningbank demo
npx agentic-flow@1.4.7 reasoningbank test
npx agentic-flow@1.4.7 reasoningbank init
npx agentic-flow@1.4.7 reasoningbank benchmark
npx agentic-flow@1.4.7 reasoningbank status
```

### ✅ Complete Build Process

- Clean rebuild with `rm -rf dist/`
- Full TypeScript compilation completed
- All 25 ReasoningBank modules compiled to dist/
- CLI handler properly linked

### ✅ Verified Package Contents

The following files are now correctly included in the npm package:

**ReasoningBank Core (dist/reasoningbank/):**
- `core/` - retrieve.js, judge.js, distill.js, consolidate.js, matts.js
- `db/` - schema.js, queries.js
- `utils/` - config.js, embeddings.js, mmr.js, pii-scrubber.js
- `hooks/` - pre-task.js, post-task.js
- `config/` - reasoningbank-types.js
- Test files: demo-comparison.js, test-*.js, benchmark.js
- Main entry: index.js

**CLI Integration:**
- `utils/reasoningbankCommands.js` - Command handlers
- `utils/cli.js` - Parser with reasoningbank mode
- `index.js` - Route handler integration

## Installation

```bash
# Install the fixed version
npm install -g agentic-flow@1.4.7

# Or use npx directly
npx agentic-flow@1.4.7 reasoningbank help
```

## Verification

After installation, verify ReasoningBank is accessible:

```bash
# Should show full ReasoningBank help menu
npx agentic-flow reasoningbank help

# Expected output:
🧠 ReasoningBank - Memory System that Learns from Experience

USAGE:
  npx agentic-flow reasoningbank <command>

COMMANDS:
  demo        Run interactive demo showing 0% → 100% success transformation
  test        Run comprehensive validation suite (27 tests)
  init        Initialize ReasoningBank database (.swarm/memory.db)
  benchmark   Run performance benchmarks (retrieval, insertion, etc.)
  status      Show memory statistics and database status
  help        Show this help message
```

## What's Unchanged

All features from v1.4.6 remain identical:

- ✅ Full ReasoningBank implementation (25 modules)
- ✅ 4-phase learning loop (RETRIEVE → JUDGE → DISTILL → CONSOLIDATE)
- ✅ 27/27 tests passing
- ✅ Performance 2-200x faster than targets
- ✅ Comprehensive documentation (1,400+ lines)
- ✅ MaTTS (Memory-aware Test-Time Scaling)
- ✅ PII scrubbing (9 pattern types)
- ✅ SQLite database with 6 tables
- ✅ All other features (66 agents, 213 MCP tools, Agent Booster, etc.)

## Migration from v1.4.6

No code changes needed - simply upgrade:

```bash
npm install -g agentic-flow@latest
```

## Technical Details

### Build Process Changes

**Before (v1.4.6 - Broken):**
```bash
# Package published before build completed
npm version 1.4.6
npm publish  # ❌ dist/ incomplete
```

**After (v1.4.7 - Fixed):**
```bash
# Proper build sequence
rm -rf dist/                    # Clean slate
npm run build                   # Full TypeScript compilation
npm version 1.4.7              # Bump version
npm publish                    # ✅ Complete dist/ included
```

### Package.json Updates

```json
{
  "version": "1.4.6" → "1.4.7",
  "bin": {
    "agentic-flow": "dist/cli-proxy.js"  // Ensures CLI accessible
  },
  "files": [
    "dist",        // ✅ Includes all compiled files
    "docs",
    ".claude",
    "validation",
    "scripts",
    "README.md",
    "LICENSE",
    "VALIDATION-RESULTS.md",
    "CHANGELOG.md"
  ],
  "scripts": {
    "prepublishOnly": "npm run build"  // Auto-build before publish
  }
}
```

## Affected Users

**Who should upgrade:**
- Anyone who installed `agentic-flow@1.4.6` and couldn't access `reasoningbank` commands
- Users who saw "command not found" errors for ReasoningBank CLI
- Anyone following the v1.4.6 release documentation

**Who is not affected:**
- Users who built from source
- Users only using the programmatic API (TypeScript/JavaScript)
- Users who didn't attempt to use ReasoningBank CLI

## Future Improvements

To prevent similar issues in future releases:

1. ✅ `prepublishOnly` script ensures build runs before publish
2. ✅ Add CI/CD checks to verify dist/ completeness
3. ✅ Add smoke tests for CLI commands after build
4. ✅ Document build verification steps in CONTRIBUTING.md

## Related Documentation

- **Full ReasoningBank Guide**: [v1.4.6 Release Notes](./v1.4.6-reasoningbank-release.md)
- **GitHub Issue**: [Issue #14](https://github.com/ruvnet/agentic-flow/issues/14)
- **ReasoningBank README**: [src/reasoningbank/README.md](../../src/reasoningbank/README.md)
- **Demo Report**: [docs/REASONINGBANK-DEMO.md](../../docs/REASONINGBANK-DEMO.md)

## Changelog

### Fixed
- 🐛 **ReasoningBank CLI commands** now accessible after npm install
- 🐛 **Complete dist/ build** included in published package
- 🐛 **CLI parser** properly routes reasoningbank commands

### Changed
- 📦 **Version**: `1.4.6` → `1.4.7`
- 🔧 **Build process**: Added clean rebuild before publish

### Verified
- ✅ All 5 ReasoningBank CLI commands working
- ✅ Help menu displays correctly
- ✅ 25 ReasoningBank modules compiled and included
- ✅ No breaking changes to existing functionality

---

**Apologies for the inconvenience caused by v1.4.6. Version 1.4.7 is fully functional and ready to use!** 🚀

Install now:
```bash
npm install -g agentic-flow@latest
npx agentic-flow reasoningbank demo
```
