Skip to content

V2 rewrite#3

Merged
ndemarco merged 179 commits intomainfrom
v2-rewrite
Apr 16, 2026
Merged

V2 rewrite#3
ndemarco merged 179 commits intomainfrom
v2-rewrite

Conversation

@ndemarco
Copy link
Copy Markdown
Owner

Substantial rework of the item schema, storage schema, and UI.

ndemarco and others added 30 commits December 17, 2025 06:39
Complete rewrite of the inventory system with:
- Next.js 16 App Router + TypeScript
- MongoDB/Mongoose data layer
- NextAuth with Google OAuth (JWT sessions)
- OpenAI-powered chat with multi-agent architecture:
  - Router agent delegates to specialists
  - Module agent for storage setup
  - Inventory agent for item management
  - Search agent for finding items
- Storage modules with dimension templates
- Item tracking with flexible parameters and units
- Token tracking with compression thresholds

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- New StorageType model with grid configurations and merge constraints
- Supports Plano boxes, Gridfinity, Stanley SortMaster, Akro-Mils
- Auto-configures subdimensions when users specify a known storage type
- Enforces merge constraints (e.g., Plano only allows column merges)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Subdimensions allow grids within drawers/levels (row x col)
- Cell merging for items spanning multiple compartments
- Merge constraints enforcement from storage types
- New tools: renameDimensionValue, addDimensionValue, removeDimensionValue
- setSubdimensions can auto-configure from storage type

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- pathValidator now handles subdimension paths (row/col within drawers)
- Resolves merged cell addresses to canonical path
- itemRepository.updateLocationPrefix for bulk location updates
- Supports dimension value renaming with automatic item updates

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use gpt-4o-mini for router agent (cost optimization)
- Add consistent location format: 📍 MODULE / dim value / dim value
- Remove filler phrases from responses
- Add dimension management tools to module agent
- Emphasize always reporting locations after operations

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Seed cache prevents redundant DB operations on every request
- Tool cache loads all tools once per server lifetime
- Agent cache avoids repeated lookups for router and specialists
- Add debug logging for tool calls and results
- Max tool iterations limit (5) to prevent runaway loops

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove DimensionTemplate (replaced by StorageType)
- Add upsertDefault to agent and tool repositories
- Update model and repository exports

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create LocationView component with results list and grid visualization
- Create StorageGrid component with color-coded result markers
- Create ModuleOverview component for module exploration
- Add /api/modules/grid endpoint for fetching grid structure and occupancy
- Integrate location panel into ChatContainer with automatic result extraction
- Extract parsePath/buildPath to client-safe pathUtils.ts

When the AI returns search results, a side panel appears showing:
- Results list with numbered, color-coded items
- Clickable results that show the storage grid location
- Breadcrumb navigation with back button
- Visual grid with empty cells, occupied (gray), and result markers

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Next.js 16 deprecates the middleware convention in favor of proxy.
This eliminates the build warning and aligns with the new API.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Propagate specialist agent tool calls to top-level response for location
  extraction (fixes side panel not showing search results)
- Implement functional sessions page that lists, loads, and deletes sessions
- Update chat page to load existing sessions from URL parameter
- Add session loading with message history when opening from sessions list

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add LocationMapPanel, ResultsPanel, ResultsList components
- Add visualization components (GridTemplate, NavigatorPanel, StorageModuleVisualizer)
- Add audit logging API and UI
- Add dashboard page
- Add chat layout with side panel
- Add docker-compose.yml for local services
- Improve chat container, message rendering, and tool call propagation
- Expand tool handlers and agent instructions
- Add session naming, storage engine, and path utilities
- Add auth server actions and User model
New models matching storage-model.md spec:
- Template (fixed/parametric, labeling, subdivision options, interface types)
- Module (primary dimension, receptacle/fixed locations, overrides, path resolution)
- Insert (template-based or structural, place/unplace/relocate, overrides)
- Item (name, description, key/value/unit parameters)
- Assignment (one-per-location constraint, multi-location items, insert-level)

Test infrastructure: Vitest + mongodb-memory-server
Specification docs: storage-model.md, item-model.md, assignment-model.md
Remove old data layer (Item, StorageModule, StorageType, ParameterKey,
Unit, AuditLog models and their repositories) replaced by v2 models.

Remove incomplete visualization components, mock data, storage engine,
path validator, location extractor, dashboard, and audit pages.

Promote v2 models and repositories to primary location.
Strip broken imports from kept files (ChatContainer, chat layout,
seed index, toolHandlers stubbed for Phase 2).

130 tests still passing.
35 tools across 6 categories (agents, templates, modules, inserts,
items, assignments) replacing the old tool set. Updated Tool model
category enum and repository types to match.
Handler functions for all 35 tools with cascade deletes, force flags,
occupancy checks, and executeHandler dispatch with timing/error logging.
Added repositories/index.ts barrel export.
3-agent architecture (router, storage, inventory) with revised
instructions to prevent internal terminology exposure and improve
delegation behavior.
dev:mem script starts MongoMemoryServer and spawns next dev, with lazy
MONGODB_URI resolution so the env var is set after the memory server
starts.
Prevent session re-fetch on URL update via loadedSessionId guard.
Add request/response logging in chat route and agent start/end
logging in agentRunner.
Coverage for all handler categories: templates (11), modules (18),
inserts (11), items (12), assignments (14). Uses mongodb-memory-server
for isolated test runs.
Delete 13 outdated/redundant specification files (3,684 lines) and
replace with a single CLAUDE.md capturing distilled project directives,
domain concepts, and architecture patterns. Keep storage-model.md and
storage-navigator-design.md as standalone references. Clean up root
.gitignore and remove diagnostic debris (dom_dump.html, check_db.ts).
Rewrite agent definitions with forceful routing instructions,
add storage and inventory specialist agents, expand tool set
across 6 categories, and implement handler dispatch map.
Implement adaptive 3-pane layout: collapsible chat (left), module
explorer with breadcrumb drill-down (center), location grid/detail
pane (right). Rework sidebar, chat messages with feedback and
loc:// links, and StorageGrid with result highlighting.
Structured logging to agent.jsonl, audit.jsonl, captures.jsonl.
Exercise harness with 22 handler-level scenarios across routing,
storage, inventory, and edge cases. Supports tag filtering and
captured-interaction replay.
Add new dependencies, update dev-memory-db script, extend
web/.gitignore, and refine storage-model.md terminology.
CLAUDE.md now contains only development directives (stack, commands,
architecture patterns, conventions). Product vision, domain concepts,
and interaction model moved to specification/project-intent.md.
PostgreSQL replaces MongoDB, multi-tenant from ground up, AI deferred.
Storage grid uses SVG rendering. Storage model adds interface types,
template versioning, provisional assignments, co-storability, ad-hoc
subdivision, axis-constrained merges, and colon-delimited path format.
Project intent updated with new domain concepts and tenancy model.
Dev commands updated for PostgreSQL/Drizzle stack. TDD with real
database and transaction rollback. CI/CD pipeline spec for GitLab
at git.demar.co with four stages. Repository scoping changed from
userId to orgId for multi-tenant model.
Rewrote storage-navigator-design.md for GUI-first model with SVG
grid, transaction log, four interaction modes, and rich cell visuals.
Removed create-next-app README and empty web/docs/.
Single-user for initial implementation, designed for future multi-tenant.
Extracted router-specialist agent patterns, tool dispatch, handler
registry, and key patterns (name-to-ID resolution, path normalization)
into specification/ai-agent-architecture.md before gutting codebase.
NickyDoes added 28 commits April 15, 2026 12:47
…ary tiles); move add-row controls to bottom
- itemRepository.suggestCategories: ranks categories by co-occurrence
  of items sharing aspects/standards with the new item.
- GET /api/items/suggest-categories?standardId=&aspectId[]=.
- CreateFromDesignationDialog: modal showing auto-applied aspects,
  suggested category chips (top-3 with match-ratio %), 'Show all…'
  expander, editable auto-filled name ('{designation} {category}').
  On Create: item -> apply standard+designation (auto-fills values)
  -> apply each linked aspect -> set primary category -> navigate
  to /items?selected=<new>.
- Entry points: '+ item' icon on each designations-table row in
  Standards tab; '+ new' per-hit button in the item-detail
  designation picker.
- GenerateSetDialog: starting from a designation, vary one parameter
  (numeric range / enum / CSV list) over N values; preview table,
  per-row toggle, one-click batch-create.
- Per item: create -> apply standard+designation (auto-fill) -> apply
  aspects -> set category -> override varying parameter. Failed rows
  stay highlighted.
- Entry point: '+ set' icon on each designation row in Standards tab,
  next to the existing '+ item' icon.
- itemRepository.findSimilar: items sharing (standardId, designationId),
  with their parameter values so the caller can refine per-row.
- GET /api/items/find-similar.
- CreateFromDesignationDialog: amber banner lists existing items with
  this designation + 'Create anyway' checkbox gates the Create button.
- GenerateSetDialog: preview rows whose varying-param value matches
  an existing item are flagged 'dup of X' and auto-unchecked.
  User can still include them manually.
…spects + bulleted lines → parameters with type/unit/enum inference, editable preview, batch save
… JSON); drop text parser; support min/max on numeric params
…tion, schema, repo, Parameters-tab edit UI)
… methods; GET routes enriched; AspectsTab list chip + detail header; Parameters tab Usage column)
…n/max, Parameters-tab edit min/max, designation form numeric values, ItemDetail numeric save)
…ts, and cross-item values; lib/audit helpers (Jaccard, dedup)
…ion + parameter table row expands to aspects/items/standards
- aspectRepository.suggestCoOccurringParameters() — co-occurrence ranking.
- GET /api/aspects/[id]/suggested-parameters.
- ParamTypeahead: optional aspectId prop; when set, fetches suggestions
  and renders 'Commonly paired with' chips above the dropdown when the
  input is empty. Hits now show an 'in N aspects' count (from phase B).
- AspectsTab drops the Detail/Matrix toggle — matrix relocates to
  ParametersTab as a secondary view with the same filter input driving
  both rows (params) and columns (aspects).
…s, right Parameter/Info tabs + inline heavy-delete)
… panel with heavy-delete). Matrix view still reachable via top toggle.
…ompose, health endpoints, journal fix, deployment.md with auth/authz/tenancy TODOs
…arkup + live glyph preview), right Info panel (count tile, items list deep-linking to /items?category=X, heavy-delete). Schema: 0012 adds categories.svg.
…o GitLab registry, manual prod deploy stub) + specification/ci.md
…quickstart, CONTRIBUTING, CODE_OF_CONDUCT, GitHub Actions CI publishing to GHCR; drop GitLab CI artifacts; point deployment.md at GHCR
…Import; relax set-state-in-effect to warn and disable no-assign-module-variable in tests
@ndemarco ndemarco merged commit dc10138 into main Apr 16, 2026
8 checks passed
@ndemarco ndemarco deleted the v2-rewrite branch April 16, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant