Skip to content

Cursor Cloud Agents are now in Graphite. Create, review, and ship without leaving your PR.

Read more

Agents - Create, review, and iterate. All in one place.

Start building with Cursor Cloud Agents, now in Graphite.

Agents
Graphite
Last 7 days
  • Database migration strategycassandra-db
  • Frontend component libraryreact-ui-kit
  • Backend server optimizationfast-api
Older
  • Code review process@monologue
  • API integration guidesupport-docs
Agent capabilities demo
monologue
View PR #1334+1,385-10
  1. New useLocalStorage Hook (src/hooks/use-local-storage.ts)
    • Full TypeScript generics support
    • SSR-compatible with hydration state tracking
    • Cross-tab and cross-component synchronization
    • Custom serializer/deserializer support
    • Comprehensive test suite (20 test cases)
  2. New debounce and throttle Utilities (src/lib/utils/debounce.ts)
    • Leading/trailing edge configuration
    • maxWait option for guaranteed execution
    • cancel(), flush(), and pending() methods
    • Full TypeScript type definitions
    • Comprehensive test suite (31 test cases)
  3. Enhanced useToggleState Hook
    • Added UseToggleStateOptions interface
    • Optional onOn, onOff, onChange callbacks
    • Added isOff convenience property
    • Maintained backward compatibility

Agent Capabilities Demonstrated

  • Codebase navigation and pattern understanding
  • Creating new TypeScript files following existing conventions
  • Writing comprehensive unit tests with Jest
  • Multi-file refactoring with backward compatibility
  • Git operations (commits, branch management, push via API)
  • CI verification
Agent capabilities demo
monologue+1,385-10
Graphite
monologue
main
Ask a question or collaborate on your next PR...
Powered by Cursor
feat: add useLocalStorage hook and debounce/throttle utils
3
Agent
@monologue #1337
Agent capabilities demo
Author avatar
Gabby Delforge
agent/capabilities...
main
9 files
+342
-118
14m ago
Stack
2 of 4
Author avatar
test: add unit tests for useLocalStorage and utilities
Waiting on CI
+96
8m
Author avatar
feat: add useLocalStorage hook and debounce/throttle utils
Checks failed
2
+342
-118
14m
Author avatar
refactor: enhance useToggleState with persistence support
+58
-12
31m
Author avatar
fix: resolve lint errors and update CI config
+24
-9
1h
Description
Edit

Summary

Introduce new useLocalStorage hook, debounce and throttle utilities, and enhance useToggleState to serve as a comprehensive demo of Agent capabilities.

Agent Capabilities Demonstrated

This PR was created to showcase various Agent capabilities, including:

  • Codebase navigation and understanding existing patterns.
  • Creating new TypeScript files following established conventions.
  • Writing comprehensive unit tests with Jest.
  • Multi-file refactoring with backward compatibility.
  • Git operations (commits, branch management, push via API).
  • CI verification and issue resolution (linting, test fixes).
Discussion
Show files
Compare Base v4 Latest version
File settings
src/hooks/useLocalStorage.ts
+48
Typescript
Viewed
Line 4 @@ const testCases
20 lines
All lines in file
1
import { useState, useCallback } from "react";
2
3
type Serializer<T> = {
4
serialize: (value: T) => string;
5
deserialize: (raw: string) => T;
6
};
7
8
interface Options<T> {
9
key: string;
10
initialValue: T;
11
serializer?: Serializer<T>;
12
}
13
14-+
export function useLocalStorage(
15-+
key: string, initialValue: unknown
16-+
) {
17-+
const raw =
localStorage.getItem(key);
18-+
const parsed = raw ? JSON.parse(raw) : initialValue;
19
20
const [stored, setStored] = useState<T>(
21
() => {
22
const item = localStorage.getItem(key);
23
return item ? ser.deserialize(item)
: initialValue;
24
}
25
);
26
27
const setValue = useCallback(
28
(next: T) => {
29
localStorage.setItem(key, ser.serialize(next));
30
setStored(next);
31
},
32
[key, ser]
33
);
34
35
return [stored, setValue] as const;
36
}
37
1
import { useState, useCallback } from "react";
2
3
type Serializer<T> = {
4
serialize: (value: T) => string;
5
deserialize: (raw: string) => T;
6
};
7
8
interface Options<T> {
9
key: string;
10
initialValue: T;
11
serializer?: Serializer<T>;
12
}
13
14-+
export function useLocalStorage<T>(
15-+
options: Options<T>
16-+
): [T, (value: T) => void] {
17-+
const { key, initialValue,
serializer } = options;
18-+
const ser = serializer ?? JSON;
19
20
const [stored, setStored] = useState<T>(
21
() => {
22
const item = localStorage.getItem(key);
23
return item ? ser.deserialize(item)
: initialValue;
24
}
25
);
26
27
const setValue = useCallback(
28
(next: T) => {
29
localStorage.setItem(key, ser.serialize(next));
30
setStored(next);
31
},
32
[key, ser]
33
);
34
35
return [stored, setValue] as const;
36
}
37
Show files
Compare Base v4 Latest version
File settings
src/hooks/useLocalStorage.ts
+48
Typescript
Viewed
Line 4 @@ const testCases
20 lines
All lines in file
1
import { useState, useCallback } from "react";
2
3
type Serializer<T> = {
4
serialize: (value: T) => string;
5
deserialize: (raw: string) => T;
6
};
7
8
interface Options<T> {
9
key: string;
10
initialValue: T;
11
serializer?: Serializer<T>;
12
}
13
14-+
export function useLocalStorage(
15-+
key: string, initialValue: unknown
16-+
) {
17-+
const raw =
localStorage.getItem(key);
18-+
const parsed = raw ? JSON.parse(raw) : initialValue;
19
20
const [stored, setStored] = useState<T>(
21
() => {
22
const item = localStorage.getItem(key);
23
return item ? ser.deserialize(item)
: initialValue;
24
}
25
);
26
27
const setValue = useCallback(
28
(next: T) => {
29
localStorage.setItem(key, ser.serialize(next));
30
setStored(next);
31
},
32
[key, ser]
33
);
34
35
return [stored, setValue] as const;
36
}
37
1
import { useState, useCallback } from "react";
2
3
type Serializer<T> = {
4
serialize: (value: T) => string;
5
deserialize: (raw: string) => T;
6
};
7
8
interface Options<T> {
9
key: string;
10
initialValue: T;
11
serializer?: Serializer<T>;
12
}
13
14-+
export function useLocalStorage<T>(
15-+
options: Options<T>
16-+
): [T, (value: T) => void] {
17-+
const { key, initialValue,
serializer } = options;
18-+
const ser = serializer ?? JSON;
19
20
const [stored, setStored] = useState<T>(
21
() => {
22
const item = localStorage.getItem(key);
23
return item ? ser.deserialize(item)
: initialValue;
24
}
25
);
26
27
const setValue = useCallback(
28
(next: T) => {
29
localStorage.setItem(key, ser.serialize(next));
30
setStored(next);
31
},
32
[key, ser]
33
);
34
35
return [stored, setValue] as const;
36
}
37
Finish your review
3 pending reviews
Comment
Request changes
Approve
Open
Merge when ready
Draft
Open
Merge when ready
Waiting to merge
This PR was sent to merge by Cameron Collis, 1 min ago.
Merged
The PR was successfully merged by Graphite on Nov 20, 2025 at 3:20 PM
Required checks failed
1 of 3 required checks failed
Graphite Chat left 1 comment
Ready to merge as stack
The PR and all of its downstack PRs can be merged.
Checks 3
View all
CI / Build
The CI failed due to a Biome linting error in useLocalStorage.test.ts
Reviewers 3
Lambert Liu
Lambert Liu
Sally Thompson
Sally Thompson
Ben Newport
Ben Newport
Labels 3
Assignees 2
Agent capabilities demo
  1. New useLocalStorage Hook (src/hooks/use-local-storage.ts)
    • Full TypeScript generics support
    • SSR-compatible with hydration state tracking
    • Cross-tab and cross-component synchronization
    • Custom serializer/deserializer support
    • Comprehensive test suite (20 test cases)
  2. New debounce and throttle Utilities (src/lib/utils/debounce.ts)
    • Leading/trailing edge configuration
    • maxWait option for guaranteed execution
    • cancel(), flush(), and pending() methods
    • Full TypeScript type definitions
    • Comprehensive test suite (31 test cases)
  3. Enhanced useToggleState Hook
    • Added UseToggleStateOptions interface
    • Optional onOn, onOff, onChange callbacks
    • Added isOff convenience property
    • Maintained backward compatibility

Agent Capabilities Demonstrated

  • Codebase navigation and pattern understanding
  • Creating new TypeScript files following existing conventions
  • Writing comprehensive unit tests with Jest
  • Multi-file refactoring with backward compatibility
  • Git operations (commits, branch management, push via API)
  • CI verification
Iterate on this PR with Cursor Agent...
Features

Agents that work where you review

Cursor Cloud Agents are built into your Graphite PR so you can create, iterate, and merge without switching contexts.

  • From prompt to PR

    Prompt a Cursor Cloud Agent and get a reviewable draft PR in Graphite. No setup, no friction.

    Added a new agent thread variant for making updates.

    Fixed. Let me commit and push.

    I'll add the debounce utility to the utils folder.

    Agent is working...
  • Seamless handoff, both ways

    Start in Cursor and pick up in Graphite, or the other way around. Your agent context travels with you either way.

  • Ship from Graphite

    Everything you need to review and ship, right in your PR. Make fixes and merge without breaking focus.

Built for the world’s fastest engineering teams, now available for everyone.