Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/modelengine-group/nexent/hook_layer_rulesgit clone --depth 1 https://github.com/ModelEngine-Group/nexentWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00634 |
| Opus 5 | $0.00000 | $0.00317 |
| Sonnet 5 | $0.00000 | $0.00127 |
| Haiku 4.5 | $0.00000 | $0.00063 |
Grade A, and why
hook_layer_rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Purpose and Scope
- Hook layer contains custom React hooks for
frontend/hooks/**/*.ts - Responsibilities: Encapsulate state logic, provide service interfaces, handle loading/error states
- MANDATORY: All hooks must be named
useXxxand use TypeScript
Hook Organization
hooks/useAuth.ts- Authentication state and operationshooks/useConfig.ts- Configuration managementhooks/useChat.ts- Chat-related state and operationshooks/useMemory.ts- Memory management- Use descriptive names indicating the hook's purpose
Hook Structure
- Use TypeScript for all hook definitions
- Return objects with descriptive property names
- Handle loading, error, and success states consistently
- Implement proper cleanup for side effects
- Use proper dependency arrays in useEffect
Essential Hook Usage
| Hook | Purpose | When to Use |
|---|---|---|
useState |
Store component state | Simple state like toggles, counters |
useReducer |
Complex state logic | Multiple state dependencies |
useContext |
Share data between components | Theme, user info, global state |
useEffect |
Handle side effects | Data fetching, subscriptions, timers |
useCallback |
Prevent function recreation | Callbacks passed to child components |
useMemo |
Cache calculations | Expensive computations |
useRef |
Store mutable values | DOM nodes, timer IDs |
State Management
- Use useState for local component state
- Use useReducer for complex state logic
- Use useContext for shared state across components
- Implement proper state updates and immutability
- Handle async state updates correctly
- CRITICAL: All logging must use logger.ts - never use console.log
Error Handling
- Handle async errors gracefully
- Provide meaningful error messages
- Log errors appropriately for debugging
- Implement retry logic for transient failures
Example
// frontend/hooks/useAuth.ts
import { useState, useEffect, useCallback } from 'react';
import { authService } from '@/services/authService';
export function useAuth() {
const [user, setUser] = useState(null);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState(null);
const login = useCallback(async (credentials) => {
setIsLoading(true);
setError(null);
try {
const response = await authService.login(credentials);
if (response.success) {
setUser(response.data.user);
} else {
setError(response.error);
}
} catch (err) {
setError(err.message);
} finally {
setIsLoading(false);
}
}, []);
return { user, isLoading, error, login };
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 86 lines · 0 tokens per session scan A e21d4f7e1ae3
hook_layer_rules is a cursor rule published in the GitHub repository ModelEngine-Group/nexent (5,841 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 634 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
latest-ai-models
Use only the latest AI models from all providers (updated Feb 2026).
callback-system
Lifecycle callback system design for agentic loops.
react-loop
ReAct loop implementation design and pattern details.
laravel-ai-sdk-integration
How Laragentic integrates with and extends the Laravel AI SDK.
developer-experience
Developer experience principles and usage patterns for Laragentic.
package-structure
Directory structure and file organization conventions for the Laragentic package.